• Breaking News

    Monday, August 17, 2020

    What language should I use? Ask Programming

    What language should I use? Ask Programming


    What language should I use?

    Posted: 17 Aug 2020 08:35 PM PDT

    I want to make a program that gets a population, takes samples and assigns samples to groups depending of the sample content combination, with me assigning the combination values. Example: Population: S G J I G C K K G K K B T O G H Random sample: S K H -All samples with S belong to group S -All samples without S belong to group B -All samples with both S and L belong to group SP etc So the program has to get the amount of groups gotten by the samples. For example a total of 100 samples gave: 13 SP 5 S 26 PA etc.

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

    Notepad++

    Posted: 17 Aug 2020 06:13 PM PDT

    I know this is not the subreddit for this but i do not know where to post it but does somebody know how to compile projects or compile the whole folder in notepad++?

    Edit: java compile

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

    What's a good optimization algorithm to determine the best locomotive for an arbitrary railroad?

    Posted: 17 Aug 2020 06:03 PM PDT

    So I'm writing up a small API for a relatively popular iOS/Android game called Pocket Trains, and I've hit up on an interesting optimization problem that I'm not sure how to solve efficiently. So in Pocket Trains, players set up railroads along tracks connecting cities where locomotives go back and forth delivering jobs.

    Locomotives also have a tradeoff between fuel capacity vs speed, where locomotives with increased fuel capacity can support longer routes while having a higher job capacity, but at the cost of lower speeds. On the other hand, locomotives with high speed can get reach places very quickly at the cost of shorter trips and a lower job capacity.

    To that end, the key question is: given a selected train route, how do I efficiently determine the optimal locomotive for that route, such it gets the best of both fuel capacity and speed? (i.e. something in the middle)

    There are several approaches that I have in mind, namely Branch and Bound, Backtracking, some kind of Dynamic Programming, and Brute Force. I can slightly improve Brute Force by eliminating obviously bad locomotives (e.g. locomotives whose fuel capacity cannot support the full route) but I'd like something faster. Which of these strategies is best suited for my problem? If there are any other approaches that I haven't listed, do let know as well!

    For those curious, I'm implementing the API with Django Rest Framework, with plans to write up a React frontend.

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

    Rust future

    Posted: 17 Aug 2020 08:34 AM PDT

    I've seen that Rust is arising in the past few years and so many programmers are satisfied to work in Rust.
    Couple of new frameworks in the last few years came up and all I could see was good reviews.
    Any Rust programmers here to share their opinions about its future ?

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

    Software developer at 37$/hr or Software engineer (aka program manager) at 58$/hr

    Posted: 17 Aug 2020 05:40 PM PDT

    I've been an Design engineer my entire career on various parts, my most recent was a hybrid of electrical engineering and software engineering. I found another job that is this software/EE at 58$/hr.

    I love programming and was offered a Python/VBA role at 37$/hr. (I've casually programmed for 12 years)

    I'm telling myself the pay cut is temporary and that this is free education.

    What do you think I should do? Pros and cons?

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

    How is an operating system able to work with all kinds of hardware without needing to install device drivers since there are multituded of computer manufacturers ?

    Posted: 17 Aug 2020 10:08 PM PDT

    i noticed that whenever i need to use a new printer i have to install it's device driver from the internet so that operating system can communicate with it . But what about all the oprical disks and monitor and key board and mouse . How does an operating system already know how to communicate with all these ?

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

    Help me

    Posted: 17 Aug 2020 09:56 PM PDT

    Hello everyone, I developed my interest on the field of programming and constantly looking for how to learn it . And most websites do tell me what to do ,what steps to be done , which languages to learn and how to start . But they don't tell me where to start . I mean , is there a software to start programming?,is it available in pc system or I have to download it !? . I am trying to learn python but I am confused what the hell is hello world? It's all so confusing for me. But I am continuesly Tring from weeks . Help me if you can . Just tell me the steps you did to start learning

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

    Find all visible elements with javascript

    Posted: 17 Aug 2020 09:46 PM PDT

    I am writing a browser extension for which I need to make a list of all links that are 'user-visible' . By user-visible I mean elements that a user can see.

    So not just exclude all elements with 'hidden' property or those that don't have 'visible' property, but also those with opacity 0, height, width 0, those not in the viewport, those covered by other elements.

    There are 2 cases with which I am struggling. First: Elements whose parents have 0 opacity, but who themselves have opacity '1' . These are not user-visible. The only solution to find if its user-visible is to navigate up the tree for each element and see if any parent has opacity 0. This sounds bad for performance. Is it ? Any other better ways ?

    Second: links that are covered over by some other element. Like with those those signup popups that cover the page. There doesn't seem to be a way to find if an element is on top with javascript. Elements can be covered by z-index modifications, absolute poositioned divs etc

    Any ideas ?

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

    creating exceptions for errors (?)

    Posted: 17 Aug 2020 03:12 PM PDT

    Sorry this is really low level but I'm kinda new.

    def check_type(x, y): global numtype global x_in global y_in print('x type : ', type(x)) print('y type : ', type(y)) if (type(x) or type(y)) != int: numtype = 0 elif (type(x) and type(y)) == int: numtype = 1 x_in = int(xy_in[0]) - 1 y_in = int(xy_in[1]) - 1 print('x in : ', x_in) print('y in : ', y_in) print(numtype) 

    sometimes arguments x and y are strings and I need to make it so that if they are the code wouldn't crash and numtype would be 0, because it's facing problems turning 'one' for example into an int

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

    What's are some best practices when designing a large database that will be constantly pulled by users?

    Posted: 17 Aug 2020 10:41 AM PDT

    Greetings r/AskProgramming!

    First time poster here. I'm designing a small application that allows for users to create their own queries to filter stock market data from my database. The queries are simply just input parameters created by the users, but following a specific template. For example, a user can chain multiple parameters such as: Price < $20 AND Sector = Technology AND Market Cap > $500million AND etc...

    The template implementation is purely from a UI/UX standpoint to allow users to input their own parameters to filter stock market data with ease. Also, this will remove any possibility of any type of malicious injection to the database.

    Because of how large scale my data-table is (6000 rows x 50+ columns). I would like to read up on the best way to implement a database that will constantly be filtering user requests and create an output that fits users parameters. I have yet to design the actual database, but I assume it will be a hybrid of relational and hierarchical data.

    I haven't been able to educate myself too much on this topic online, does anyone know of any resources I could read up on to help me and make myself more aware of some pro's and con's. Also, if you have developed something similar I would love to hear any feedback or mistakes you made a long the way. I'm pretty much new to this type of back-end development, my programming knowledge comes from analyzing data using Python and a bit of SQL.

    Looking forward to your comments!

    Many thanks.

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

    Suggestions for introducing a 13yo to programming?

    Posted: 17 Aug 2020 06:08 PM PDT

    My nephew asked me to help him earn money to build a PC of his own. I was thinking of having him take an introductory programming course as a way of earning the money. So I'm looking for some suggestions for a good online course for teenagers.

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

    Problem's with JQuery setup and use.

    Posted: 17 Aug 2020 01:21 PM PDT

    I am trying to learn how to use JQuery and was having problems with it in another project I was working on. I decided to create a new project to just test if it was working correctly and try to learn it a bit better before trying to move on with the original. The code I am now using for this file is much more simple and I am still running into the same problems that I was having originally. The JQuery videos I am using I found were on youtube by Dani Krossing if that helps provide reference for anyone. I placed the JQuery.min file in its own folder for the project and have only one HTML file made. The compiler I am using is PyCharm and the code of the file is:

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="Static/js/jquery-3.5.1.min.js"></script> </head> <body> <p id="test">This is a paragraph</p> <script> $("test").click.function(){ alert("Clicked"); }); </script> </body> </html> 

    When I open this file using PyCharm only the "This is a paragraph" part shows up. From the video it appears that if I click the page an alert should show up but nothing happens. It almost seems like the library of commands isn't there because there weren't dropdowns or font changes in the script like I was expecting. I am trying to teach myself to code right now so I don't have anyone I can ask about these things directly I am almost certain the issue is something simple but I've been stuck on it for a while and its becoming very frustrating. I would appreciate any help that can be given.

    Edit: I needed to change the code because originally I put up the Java script section not the JQuery Part. Apologies, but the issue of nothing but the paragraph part is the same.

    submitted by /u/Wiseman-no
    [link] [comments]

    Create a screen reader and interpreter?

    Posted: 17 Aug 2020 04:25 PM PDT

    Hello! So, I'm rather new to coding in Python.. I'm currently working on a project that requires me to read parts of the screen, and create input based upon what it sees. For example, it reads from (x,y) to (x,y) on my screen, and translates it into an int. It reads (9 + 10) from google chrome, and then it inputs (19, and then the enter key). Anyone know how I could do this?

    sorry if this is the wrong subreddit...

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

    Program is giving can't find errors for that I direct it too and Register page I made is putting information in url bar instead of storing it.

    Posted: 17 Aug 2020 04:03 PM PDT

    The project that I am currently working on has a couple of downloaded files needed to function. The example that I am following for this project has the files that they need entered as:

    $var js: Static/js/bootstrap.min.js Static/js/jquery-3.5.1.min.js Static/js/scripty.js 

    but when I do the same thing for my code I get errors listed like:

    GET /Static/js/scripty" - 404 Not Found GET /Static/js/scripty.js" - 404 Not Found GET /Static/js/bootstrap.min.js" - 404 Not Found 

    I don't know if the issue has something to do with the GET command that I use or if it can't locate the files. I have them stored in the same locations as the they should be and have deleted and re-downloaded to see if that solves the issue but they continue to not be found. I think that if I can solve this the register page problem would go away because the scripty file that it keeps not finding is part of a JQuery code set that helps handle the registration information. This is the controller page of the project I am working that contains the GET commands:

    import web from Models import RegisterModel urls = ( '/', 'Home', '/register', 'Register', '/postregistration', 'PostRegistration' ) render = web.template.render("Views/Templates", base="MainLayout") app = web.application(urls, globals()) class Home: def GET(self): return render.Home() class Register: def GET(self): return render.Register() class PostRegistration: def POST(self): data = web.input() reg_model = RegisterModel.RegisterModel() return data.username if __name__ == "__main__": app.run() 

    The files that it says that it can't find are stored in a folder labeled Static then another folder named js and I can find them easily on the project taskbar on the side of the compiler so I know that they are downloaded to be used. That's all the information I can really provide that I think outlines the problems I'm running into. If your familiar with the problem please let me know how to resolve it. Here is the content of the scripty file that it is trying to use:

    $(document).ready(function(){ console.log("loaded"); $.material.init(); $(document).on("submit", "#register-form", function(e){ e.preventDefault(); var form = $('#register-form').serialize(); $.ajax({ url: '/postregistration', type: 'POST', data: form, success: function(response){ console.log(response); } }): }); }): 
    submitted by /u/Wiseman-no
    [link] [comments]

    Very basic macro/hotkey question from a beginner

    Posted: 17 Aug 2020 11:35 AM PDT

    Let me start out by saying, I know very very little about coding. I am trying to achieve a way to have predetermined text be pasted when I click a key combination (ie: when I press alt-shift-1, "Hi, my name is Bob. Nice to meet you! I enjoy: -Running -Biking -Swimming" appears). <Actually much more text than that, but this get the point accross - text, returns, and symbols. So far here is what I have done, with little to some luck Downloaded autohotkey. Written a script in microsoft notepad: !+1:: SendInput, Hi, my name is Bob. Nice to meet you{!} I enjoy:{enter}-Running {enter}-Biking {enter}-Swimming Return

    Then when I press the command, everything appears. Where the problem is, is after everything is entered, it won't let me select to edit the text, or highlight it (doing this in a word doc). Also anytime I press the enter button, it will insert the most recently typed line, not do a return? I've tried to search online for a solution but either a) haven't been able to find the answer or b) found the answer without actually understanding it was the answer due to my lack of coding knowledge. Any suggestions are appreciated!

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

    How do executable files produced from Wine wrapper have errors when wrappers create a 1:1 mapping from Windows commands to POSIX commands?

    Posted: 17 Aug 2020 07:15 AM PDT

    This is probably a pretty noob question in regards to wrappers. I'm wondering how errors could be introduced that weren't in the program before if there is supposed to be a 1:1 mapping between the commands native to the two operating systems the wrapper converts between. Could it be that things meant to replace some parts of the operating system programs use (such as how Wine creates a sort of Windows directory for the program to use) might not be made properly?

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

    How is the walrus operator ':=' in Python similar to the '=' operator in C?

    Posted: 17 Aug 2020 07:49 AM PDT

    In this Lex Friedman video, a := operator is described, which as far as I can gather will assign the right side to the left side, and then return the left side from the function.

    I'm only vaguely aware of how Python works, but I'm afraid I don't really understand what he means when he says that this functionality is similar to the '=' operator of C. In C, let's say I wrote

    x = 42;

    within a function. This, surely, would not immediately return 42 from the function. So I am having a little bit of trouble understanding exactly what is meant by this.

    Any insight you could give me would be much appreciated. As a side note, what do you think about the Python walrus operator in general. A bad design decision? A good one?

    Cheers.

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

    Can you have multiple versions of the same project?

    Posted: 17 Aug 2020 12:28 PM PDT

    I have what I'd consider the base for my project. I'd like to add some substantial changes BUT keep a copy of the base version just in case I need to revert.

    Is there a technical term for this? And is there a better way than copy/pasting workspace folders in a "backup" folder? I'm using Eclipse.

    Thanks guys :)

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

    Are the tests I make in POSTMAN considered unit tests?

    Posted: 17 Aug 2020 06:10 AM PDT

    What is the type of testing that you do in POSTMAN when hitting APIs and checking the response? Is it unit testing? Contract testing? Something else?

    The reason I ask is that I generally hate unit testing but I do like testing using Postman. The tests feel less fragile because the test is not tightly coupled to the implementation.

    Postman says "Postman can be used to automate many types of tests including unit tests". However, I'm not sure that they really are unit tests. You can check one endpoint but that endpoint could be calling lots of functions you created.

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

    SQLite Database Deletion of an Item Not Working as Intended (Java, Android)

    Posted: 17 Aug 2020 12:07 PM PDT

    Can anyone help me with this HTML code

    Posted: 17 Aug 2020 10:43 AM PDT

    Throw away account here but i'm new to coding and have a question. This is for a class im taking and I'm trying to get this image link to work but for some reason its not and its just blank on the page. I have been stuck on it for a while so if anyone can help I'd greatly appreciate it.

    <ul>

    <li><a href="#"><img src="[https://ga-instruction.s3.amazonaws.com/assets/myga-html-css/facebook.png](https://ga-instruction.s3.amazonaws.com/assets/myga-html-css/facebook.png)" alt="Facebook" /></a></li>

    <li><a href="#"><img src="[https://ga-instruction.s3.amazonaws.com/assets/myga-html-css/twitter.png](https://ga-instruction.s3.amazonaws.com/assets/myga-html-css/twitter.png)" alt="Twitter"/></a></li>

    <li><a href="#"><img src="[https://ga-instruction.s3.amazonaws.com/assets/myga-html-css/instagram.png](https://ga-instruction.s3.amazonaws.com/assets/myga-html-css/instagram.png)" alt="Instagram"/></a></li>

    </ul>

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

    How would you code a raffle-based program?

    Posted: 17 Aug 2020 10:07 AM PDT

    I'm not asking for the code to be written. I'm planning to write a program that draws raffle tickets. Which sorts of API do you use? I don't have much coding experience but I can definitely look into API or built-in classes.

    I'm planning to do a raffle draw for 10 winners. Chance of winning are based on total number of tickets and how many tickets each person has. A person cannot win the draw more than once so once his/her name is called, they will be removed from the ballot. How do I program a weighted-random number draw that would?

    Here's the data (I converted this all to excel and counted all unique entries): https://pastebin.com/iSu2D8vY

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

    Has the internet led to people doing more work?

    Posted: 17 Aug 2020 10:02 AM PDT

    Im fresh out of college so i don't know, I was just wondering if the internet has made people have more work, i know that you can find solutions faster but with the time saved there, you get more things added to your spring. Is it true?

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

    Undergoing a huge code base refactor -- where to start?

    Posted: 17 Aug 2020 08:47 AM PDT

    In my current position, I've inherited a code base that is...absolutely a mess. And we've hit the wall on ignoring it to get things through -- that is, we can no longer add functionality or change functionality without other things inadvertently breaking.

    So it is time. We have to refactor and to be honest re-architect a not insignificant amount of code.

    Any advice on approaching this? I'm kind of overwhelmed looking at the mountain of things that need to be changed and I'm not entirely sure where I should start.

    My current options are looking like:

    1. Start with broader used classes and work towards single use classes, in terms of software dependency.

    2. Start with highest impact classes/components to lowest impact classes/components in terms of user experience.

    But in general, any and all past experiences or advice or things to read would be helpful.

    Thanks so much

    Side notes: We have technically 2 code bases, front-end in Vue and back-end in Node.

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

    No comments:

    Post a Comment