• Breaking News

    Tuesday, April 14, 2020

    For someone that already knows several high-level languages and wanting to learn more about low level stuff, should I learn C++ or Rust next? Ask Programming

    For someone that already knows several high-level languages and wanting to learn more about low level stuff, should I learn C++ or Rust next? Ask Programming


    For someone that already knows several high-level languages and wanting to learn more about low level stuff, should I learn C++ or Rust next?

    Posted: 14 Apr 2020 04:09 PM PDT

    I already know several high-level languages (python, javascript, C#, etc...) and next want to try learning some lower level stuff. This is purely to expand my knowledge and there is no particular goal in mind.

    I've researched several potential candidates for this (C/C++, Rust, Zig, D). However, after all of this research I'm torn between investing time between C/C++ and Rust. On one hand, there is so many really important open source projects written in C/C++ that I feel like having some knowledge of this would be very important. Also, one use case I could possibly make use of is Python's deep integration with C (python can call C functions natively: https://docs.python.org/3/extending/extending.html). However, everything I've also read leads me to believe that C++ is a terrible hacked together language that should have been superseded by something better long ago. Furthermore, I don't really want to waste time learning a language that is in declining popularity.

    On the other hand, I've read that Rust would be much easier to learn and is a much more modern language, learning from the mistakes in C++. It is growing in popularity and looks like it has a bright future ahead. But I've also heard that having a good understanding of C/C++ would make understanding some concepts in Rust much easier, so I may have to learn both anyway.

    What would you recommend I learn next?

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

    Can I make querying APIs easier/more automated?

    Posted: 14 Apr 2020 06:40 AM PDT

    Some background: I work in a less 'technical' role at a software company (analyst). Part of my job involves querying APIs frequently (typically only changing 1 or 2 values in the query) looking for issues/changes in the response. Right now I use postman to make API calls and I have a word doc that has all of the API documentation.

    The issue is, all of the calls I have to make contain various unique IDs that usually require me to make another API call to retrieve, So I make one call for a list of all items in inventory + their IDs, then use that ID to make another call to get more information on that particular item.

    Is there any way to automate this kind of work or even just make it easier to manage (removing the back and forth I have to do between API calls)?

    Bonus question: sometimes I have to find an item with a particular attribute value, so I would have to make an API call for the full list of inventory and then do individual calls for each inventory item until I find any with that particular attribute, is there anyway to do a blanket search (i.e make many queries with each ID until you find one where attributevalue = 'x')

    Thanks for any help/advice

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

    Math or statistics: which makes you a better programmer?

    Posted: 14 Apr 2020 07:18 PM PDT

    I'm choosing between the two to combine with my CS minor. They're the only options I have under my full sponsorship. My main interest is in Machine Learning for graduate school and I know math would be more ideal, but I wanted to know about programming, please.

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

    Do you actually DELETE data or do you just archive them in production?

    Posted: 14 Apr 2020 10:28 AM PDT

    What is Haskell used for?

    Posted: 14 Apr 2020 09:02 PM PDT

    I'm taking an algebra course and we are learning to program in Haskell. I knew a bit of python before this and I wonder, why would anyone use Haskell instead of python?

    Are there any advantages?

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

    Easy R question...but I'm stuck

    Posted: 14 Apr 2020 08:09 PM PDT

    I have a list of values, lets call them positions:

    position

    1

    10

    100

    150

    300

    500

    900

    1111

    1112

    1222

    I'm trying to add a column that would look at each value in the "position" column and then sum up how many values are within +/-100 of that value. For example:

    position count

    1 _______ 3

    10 ______ 3

    100 _____ 4

    150 _____ 2

    300 _____ 1

    500 _____ 1

    900 _____ 1

    1111 _____ 2

    1112 _____ 3

    1202 _____ 2

    But whenever I run the code, it just gives me 0's all down the "count" column:

    position count

    1 _______ 0

    10 ______ 0

    100 _____ 0

    150 _____ 0

    300 _____ 0

    500 _____ 0

    900 _____ 0

    1111 _____ 0

    1112 _____ 0

    1202 _____ 0

    Here is the code I was using:

    df$count<-sum(df$position>=df[["position"]]-100 & df$position<=df[["position"]]+100)

    What am I doing wrong?

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

    Problems with positioning images

    Posted: 14 Apr 2020 06:32 PM PDT

    I have three images for my web page that I would like to place in certain positions. however, anything i've tried breaks other images, the page, or looks great for me and absolutely broken for others. so far i've tried:

    relative positioning: looks great, but it stretches out the web page

    absolute positioning: fixes the stretching but never looks right when others look at it, and on any browser other then chrome

    fixed positioning: same problem as absolute

    I'm very new to html and css and have been working on this for the whole day, any help would be appreciated

    I wish I could send an image of some kind but dems the rules :/

    submitted by /u/V-Happy18
    [link] [comments]

    Is there a way to access the source code of GBA videogames to port their engine into another platform?

    Posted: 14 Apr 2020 06:15 PM PDT

    I'm really new to programming, but I want to remake a game that was abandoned by its company. The game is about one week away from turning 17-years-old, and wasn't ported anywhere other than the GBA, nor did it have merchandise. It had two sequels, and the latter was never localized.

    First, is it legal? The company that made the game is known for it's positive reception towards fangames (Atlus, behind which is SEGA) but I don't know if this would be taking it too far.

    Second, is it possible? How?

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

    How can I setup the best Linux environment from my Windows 10 PC?

    Posted: 14 Apr 2020 04:32 PM PDT

    I've upgraded my PC from Win7 to Win10 earlier this year and lost my previous environment. It's fine since it felt pretty ad hoc. I used Virtualbox to make a Linux VMs which all felt pretty messy. I also used some development on the host Windows but I'm not interested in that for now.

    Is there some guide for setting up an environment? I imagine starting with Lubuntu and Anaconda but not so clear on anything else.

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

    Array / programming

    Posted: 14 Apr 2020 04:32 PM PDT

    Can someone explain array to me like I am 5 years old. I think there are 1 and 2 dimensional arrays.. but they do not make sense to me. I have a project coming up and the main part of the project is, "you will code a user-friendly program with an array data structure that processes the elements of the array logically. "

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

    Large data manipulation, excel is too slow. Can I program something to help?

    Posted: 14 Apr 2020 10:05 AM PDT

    For background I have a very basic understanding of coding. I've done some matlab and python hello world exercises back in my youth. My situation is I have a larger data set. 290 rows by 216 columns. What I want to do is have the first row and subtract it from every other row and store those results in a table.

    Then take row 2 and subtract it from every row and store those results in a table. I would do this for every row all the way down. So in all the final tablen with all results would have 42,000 or so rows by 215 columns. Using this data set I would need to use if and then statements to analyze my final results.

    My work computer is slowing down with me doing this in excel and I am no where near finished.

    Just to give context to what I am doing. I have 290 different steel chemistries with 43 alloying options or restrictions. Each alloy option has 5 ranges of acceptability. That is my initial data set. I want to set up a logic system to determine compatibility when casting based off the absolute difference between each chemistry system. For instance if carbon is within 2 points and manganese is within 10 for the maxes and mins then the transition between the two grades is prime. I will have logic like that for each element or restriction and the 5 acceptability limits for each one. So at the end of this I will have a 290x290 table telling me if one chemistry is prime, non prime, or scrap during transition to another chemistry.

    I can do this in excel given enough time. However it is bogging down and I have not even finished populating the table. Is there a different way that I am not seeing in excel? Can i do this in some language that can handle data sets?

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

    what high level changes to game software architecture have allowed for effective multithreading?

    Posted: 14 Apr 2020 02:16 PM PDT

    I have an old phenom x6 1100t that has seen improved throughput over the years, back 6 years ago i was always CPU starved and struggling to drive my GPUs to full potential, nowadays there are many titles like battlefield1 that are allowing my old shitty CPU to drive graphics far above what it was only able to do before multithreading, mantle, vulkan, etc. optimizations were made.

    what kind of changes happened to e.g. game operating logic loop to allow this to happen? is there still one main while loop that's still managing everything?

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

    What should I use to develop my project?

    Posted: 14 Apr 2020 02:14 PM PDT

    First of all sorry for any spelling or grammar mistakes english isn't my native language. So my project topic is developing a website that takes user input and searches a database of audio files, each audio file contains two letters and the person pronounces them. For example if the user writes "apples" my program needs to match those letters to the ones in the database (ap with audio file where ap is pronounced, pp from audio file pp, and so on) combine the audio files from the database and upload them so the user can play them(my native language is phonetic so it will sound okish). The point is to develop a basic text to speech. Furthermore i need to ask users what they think of the returned audio(was it understandable, did it say the right words, etc). I am wondering what would be the most appropriate technology, should I use django, JS? or something else. If you have more questions about the project I am happy to answer, thanks in advance!

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

    What language is this and where i can start learning

    Posted: 14 Apr 2020 01:18 PM PDT

    https://github.com/B74nk/EFT-Mono-InsideJoke

     

    This is the files i want to learn how to build it and use it so what language is this and a good place to start learning.


    [link] [comments]

    Need advice for synchronising user input reactions as video frames appear (Python)

    Posted: 14 Apr 2020 05:36 AM PDT

    Apologies if this is a bit vague, I'm not looking for the answer to be handed to me, just a push in the right direction.

    I'm relatively new to GUI design and Tkinter but I've decent experience with Python. Basically I want to have a video feed playing on a GUI (from a local file) and the user reacts when they see specific things on the feed, by pressing the spacebar or something similar. The timings would also then be displayed on the GUI.

    I can do either things separately, receive user inputs through the keyboard and playing the video file fine, it's synchronising the two that's the problem - I'm not sure how to approach this.

    In essence, it's a reaction test for when the user sees specific things on the video, so I'd ideally like to see the time between a specific frame appearing and the user pressing the space bar and have it all on the one GUI (though the GUI isn't a requirement at this time, command line would suffice for now). Is it possible to get this level of synchronisation on a Tkinter GUI or would I be better off using something else? Ideally still using Python.

    Thanks in advance

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

    CSS I need the max value of ScrollLeft

    Posted: 14 Apr 2020 12:47 PM PDT

    In Firefox there is a value of ScrollLeftMax. And that works great, but it's not supported on other browsers. Does anyone know how Firefox calculates that value?

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

    Flutter+Dart list all PDF in directory on Android

    Posted: 14 Apr 2020 11:54 AM PDT

    I want to list all PDF files that contain certain word in name of the file from lets say Downloads directory into listview.

    Can somebody point me into what I should be looking for? I'm new to android developement and this all seems a bit too confusing (I've done this in python for my PC,but cant wrap my head around doing it on Android).

    I'm not looking for a complete solution,just to point me in the right direction.

    From what I gathered, I should be asking user for permission to access folders? Then maybe use listSync to get all files from a directory and then remove all files that don't contain *word*pdf?

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

    Algorithm to detect abnormal value distribution

    Posted: 14 Apr 2020 11:48 AM PDT

    Suppose normal table values look like this 1 6 2 4 3 7 4 3 5 5

    And a suspicious pattern looks like this 1 2 2 1 3 35 4 0 5 1

    Is there any algorithm to detect the suspicious pattern?

    [Edit: new to reddit and cant format the table values. They are 2 cols, 5 rows each.]

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

    This question isn't necessarily about programming, but closely related...

    Posted: 14 Apr 2020 11:41 AM PDT

    Where is the add-in manager on the Ubuntu version of monoDevelop. I need the Version control section so I could disable some add-ins. Most tutorials online are telling me to open the add-in manager from the Tools bar, but it's just not there, nor is anything similar.

    Thanks in advance.

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

    How to make bat script ignore spaces

    Posted: 14 Apr 2020 11:07 AM PDT

    Hello everyone,

    We are currently migrating over to a new website, and need help zipping and moving files to a new folder. Currently, this is how they're structured:

    Repository\Project Files\P1-2

    Repository\Project Files\P1-3

    Repository\Project Files\P2-2

    Repository\Project Files\P2-3

    Each one of the subfolders contains about 10 files, each with a different type. For our new website, just need 5 specific types, and plan on just putting everything in one big root folder instead of all of the subfolders we currently have.

    The first script I made is below, which goes through each folder and zips up the files i need from them (*.SLDDRW,*.igs,*.sat,*.step,*.x_t,*.sldprt),

    Script below: FOR /R C:\Users\me\Documents\Repository\ %%G IN (*.SLDDRW,*.igs,*.sat,*.step,*.x_t,*.sldprt,) DO "c:\Program Files\7-Zip\7z.exe" a %%G.zip %%G && del %%G

    This works, and does almost exactly what I need it to. The only issue I am having with it is if a folder contains spaces in it, it won't work. For example, when the script goes makes it's way down to C:\Users\me\Documents\Repository\Angler Pins, it doesn't work. It runs, but all it does is create a zip named "Angler" without the Pins, and just stuffs all the subfolders and files inside of it. I saw on a form to try and insert the "delims=" parameter, but the script won't even run if that's there. Any advice or suggestions would be appreciated.

    Thank you!

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

    Help with boolean values in C

    Posted: 14 Apr 2020 10:56 AM PDT

    hello everyone I currently have to create a method in C using only the <stdio.h> library that is able to keep track and determine if a number is whole or not. In java i simply would use a boolean value and if its true i would add to a counter but my problem is in C there is no traditional boolean values. How would i go about determining if an expression is true or not in C?

    thank you

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

    Anyone know what's wrong with this? The module isn;t

    Posted: 14 Apr 2020 10:22 AM PDT

    option = 'y'

    while option.lower() in {'y', 'ye', 'yes'}:

    import random

    def pickRandomCard(all_cards):

    count = len(all_cards)

    randomIdx = random.randint(0, count-1)

    card = all_cards.pop( randomIdx )

    return card

    def dealCards(all_cards):

    cards_1 = []

    cards_2 = []

    cards_3 = []

    while ( len(all_cards) > 2):

    chosenCard = pickRandomCard(all_cards)

    cards_1.append(chosenCard)

    chosenCard = pickRandomCard(all_cards)

    cards_2.append(chosenCard)

    chosenCard = pickRandomCard(all_cards)

    cards_3.append(chosenCard)

    return (cards_1, cards_2, cards_3)

    '''

    This method will take in the value of a card which is stored as a String

    It will then look at the string and convert it to a number value

    For this version "1" through "10" convert directly to their integer counterpart.

    "J", "Q" and "K" should be convert to 10.

    It will return the integer value for that specified card

    So...

    "3" --> 3

    "7" --> 7

    "10" --> 10

    "Q" --> 10

    "J" --> 10

    '''

    def convertCardToNumber(card):

    value = 0

    # first convert J, Q, K to the integer value 10

    if (card == "J"):

    value = 10

    elif (card == "Q"):

    value = 11

    elif (card == "K"):

    value = 12

    elif (card == "A"):

    value = 13

    else:

    value = int(card)

    return value

    '''

    HINT: pay attention to datatypes of parameters

    Remember you CANNOT concatenate an integer with a string -- you have

    to do "something" to the integer first

    '''

    def printOutWinner(player_1_name, player_2_name, player_3_name, p1_score, p2_score, p3_score):

    if (p1_score > p2_score and p1_score > p3_score):

    print( player_1_name + " placed first! " + player_2_name + "placed second!" + player_3_name)

    print(str(p1_score) + " to " + str(p2_score) + "to" + str(p3_score) )

    elif (p2_score > p1_score and p2_score > p3_score):

    print( player_2_name + " placed first! " + player_1_name + "placed second!" + player_3_name)

    print(str(p2_score) + " to " + str(p1_score) + "to" + str(p3_score) )

    elif (p3_score > p1_score and p3_score > p2_score):

    print( player_3_name + " placed first! " + player_1_name + "placed second!" + player_2_name)

    print(str(p3_score) + " to " + str(p1_score) + "to" + str(p2_score) )

    elif (p3_score == p1_score and p3_score == p2_score and p2_score == p1_score):

    print("All three players tied!")

    print(str(p3_score) + " to " + str(p1_score) + "to" + str(p2_score) )

    elif (p3_score == p1_score and p3_score > p2_score):

    print(player_3_name + "and" + player_1_name + "tied for first!")

    print(str(p3_score) + " to " + str(p1_score) + "to" + str(p2_score) )

    elif (p2_score == p1_score and p2_score > p3_score):

    print(player_2_name + "and" + player_1_name + "tied for first!")

    print(str(p2_score) + " to " + str(p1_score) + "to" + str(p3_score) )

    elif (p3_score == p2_score and p3_score > p1_score):

    print(player_3_name + "and" + player_2_name + "tied for first!")

    print(str(p3_score) + " to " + str(p2_score) + "to" + str(p1_score) )

    #main code

    # Full deck of cards without any suits (Spades, Diamonds, etc.)

    all_cards = ["2","3","4","5","6","7","8","9","10","J","Q","K","A","2","3","4","5","6","7","8","9","10","J","Q", "K","A","2","3","4","5","6","7","8","9","10","J","Q", "K","A","2","3","4","5","6","7","8","9","10","J","Q", "K", "A"]

    player_1_cards = []

    player_2_cards = []

    player_1_name = input("Enter the name of Player 1: ")

    player_2_name = input("Enter the name of Player 2: ")

    player_3_name = input("Enter the name of Player 3: ")

    # Use the dealCards function to return player_1_cards and player_2_cards. Remember it is returning

    # a tuple of both players cards lists so you have to assign both value to the return value from

    # calling the dealCards() function

    (player_1_cards, player_2_cards, player_3_cards) = dealCards(all_cards)

    print (player_1_cards, player_2_cards, player_3_cards)

    '''

    This game will simply loop through the cards one at a time in each players

    hands. It will use the rules of "war" -- the higher card wins, ties -- no one wins

    For each "hand" -- each iteration of the main loop, it will print NAME of the

    winner of that individual "battle" and increase the points total for that player

    After ALL the hands have been played (the for loop is done) It will print out the overall winner NAME and score

    '''

    # Loop through X number of hands, play war and add up total

    numHands = len(player_1_cards) # since each player has the same number of cards this will work

    p1_score = 0

    p2_score = 0

    p3_score = 0

    for lp in range( numHands ):

    # Get next card from each player

    card_p1 = player_1_cards[lp]

    card_p2 = player_2_cards[lp]

    card_p3 = player_3_cards[lp]

    card_value_p1 = convertCardToNumber( card_p1 )

    card_value_p2 = convertCardToNumber( card_p2 )

    card_value_p3 = convertCardToNumber( card_p3 )

    # print the values of each player's cards

    print(player_1_name + ": " + card_p1)

    print(player_2_name + ": " + card_p2)

    print(player_3_name + ": " + card_p3)

    # Card with higher value is winner, tie is no points for either

    # Create an If, elif, else clause that will determine if player 1 or player two had higher card

    # and increment player totals as appropriate

    if (card_value_p1 > card_value_p2 and card_value_p1 > card_value_p3):

    p1_score = p1_score + 1

    print(player_1_name + " wins this hand...")

    elif (card_value_p2 > card_value_p1 and card_value_p2 > card_value_p3):

    p2_score = p2_score + 1

    print(player_2_name + " wins this hand...")

    elif (card_value_p3 > card_value_p1 and card_value_p3 > card_value_p2):

    p3_score = p3_score + 1

    print(player_3_name + " wins this hand...")

    elif (card_value_p1 == card_value_p2 and card_value_p1 > card_value_p3):

    print(player_1_name + player_2_name + "tied ")

    print("No points awarded.")

    elif (card_value_p3 == card_value_p1 and card_value_p3 > card_value_p2):

    print(player_3_name + player_1_name + "tied ")

    print("No points awarded.")

    elif (card_value_p3 == card_value_p2 and card_value_p3 > card_value_p1):

    print(player_3_name + player_2_name + "tied ")

    print("No points awarded.")

    print("")

    # you have to complete the definition of the printOutWinner()

    # function up above

    printOutWinner(player_1_name, player_2_name, player_3_name, p1_score, p2_score, p3_score)

    option = input("again? (y / n): ")

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

    Python tkinter callback functions question.

    Posted: 14 Apr 2020 10:05 AM PDT

    Hello Guys,

    i have a question regarding some tasks ive been assigned to do with python.

    The task was to make a simple GUI Program with tkinter to have 3 Buttons ("german", "english", "french") and depending on which button is clicked one label text should update and display some text in the choosen language. Programming this was fairly easy. My questions are now regarding 2 things about this task.

    I've used callback functions (using command = lambda: somefunction(x)) on the buttons to call the fuction which displays the right text when the button is clicked. Therefore i have used 3 callback functions for these 3 buttons. Is there anyway that we could use less than 3 callbacks to have the same functionality or is 3 the minimum requiered?

    And then what would be the maximun an usable callbacks for the functionality of this program?

    As you can guess, this 2 questions are 2 tasks that were asked by my teacher. I've been thinking about it and i come to the conclusion that we need atleast 3 callback functions in total, so at least one for every button. On the other hand i dont think there would be an limit to how many callbacks i could use maximal or am I wrong? theoretically i could nest callbacks in eachother as much as i want and the program should still work.

    But im very unsure about my answers thats why I hope somebody here could guide me a little bit and help me out. Im very sorry for this kinda noob question

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

    Entertainer tracking solution?

    Posted: 14 Apr 2020 09:14 AM PDT

    Hello friends,

    I've been asked to help in the development of a solution to track and monitor costumed entertainers in a theme park. So far, they already have a system in which the entertainer carries a smartphone, and every few seconds the smartphone uploads the coordinates to a MongoDB. Now, what we need to do is a graphical interface with the park map, that shows the location of each entertainer, so the park employees can monitor which areas of the park are lacking characters (so an entertainer can be sent there), as well as check if they're all within the park limits.

    I have began experimenting with HTML canvas to see if it would be a good idea, but it seems that it would become very slow once you get to 50+ entertainers being tracked.

    So I have come to ask for any ideas on how this could be developed, what languages/solutions could be used, and what would be needed.

    Thanks in advance!

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

    No comments:

    Post a Comment