r/programmingbytes • • Mar 12 '21

Monte Carlo Simulation

1 Upvotes

Monte Carlo Simulation

I am looking for a bit of help building a model to simulate, I essentially want to prove that the socially optimum point for two petrol stations to be is at distances 0.25 and 0.75 along a 1 mile road.To do this, I am thinking of using Monte Carlo to place two points on the line (the petrol stations) and then have 100 random points on the line and it calculates the minimum average distance, I then want to move the two initial points and do this process again, hopefully thousands of times and this should produce the minimum distance for both points is at around 0.25 and 0.75. Would anyone know how to start this and which direction to take as I think it is a complex one? Thanks, Jamie


r/programmingbytes • • Mar 12 '21

How to create a bot that checks websites, autofill a form and can fill captcha?

1 Upvotes

How to create a bot that checks websites, autofill a form and can fill captcha?

Hi guys,I'll tell you a little bit of what I want to use it for, I know that the title make it seems like it may be something sketchy but I promise that is not.Me and my girlfriend are living in Europe now with a working holiday visa (You can google what it is if you are interested in it), the one we have is about to finish and we want to get one in another country. There are a few embassies in Europe where we could apply for this visa, but you need an appointment, these are really scarce right now given that there are a few countries that cancelled this kind of visa so everyone is applying to the same 2 or 3 countries.The issue with this is that there's a guy who has a bott (or that is what everyone says) that is taking away all the appointments available for the different embassies and selling these appointments for 50, 100 and even 200 euros. The few people I know that could get one of these appointments had to buy them from this guy. I know this is illegal and we wrote to the embassy of this country (Germany) but they said that they can't do anything if this guy doesn't live in Germany. I don't have a problem paying this guy, I know that what he does is illegal but unfortunately I do not have an option right now (our country is an undeveloped country that is going through a huge crisis and we don't want to come back at least until this corona thing is solved), but he won't even sell to us because the priority apparently is for friends of his friends and another people.With all this we don't really know what to do, we have something between one month and one month and a half to get an appointment, once or residency expires we lose the chance of applying. That's why we were thinking of this bott, we would only get our appointments and that's it.The whole process is:First there's a captcha that you have to fill to be able to see all the appointments availables.Second you get to pick the day of the appointment and hour supposing that there's any available.Third you fill all your information and at the end of this you have another captcha that you have to do.​Is there anything that I could to that checks this websites every few seconds or at a specific hour that could do all these steps? How difficult would it be to make for a newbie supposing that it is even possible?Thanks a lot for the help guys, these really means a lot for me and my girlfriend.Best regards


r/programmingbytes • • Mar 12 '21

Python: Best way to parse song lyrics to count the number of occurrences of words from a list

1 Upvotes

Python: Best way to parse song lyrics to count the number of occurrences of words from a list

I'm working on parsing different song lyrics to count how many times the key vocab words (that are assigned to each song) appear. I'm very new to dealing with string data using Python, so first tried using the nltk package but quickly learned that the word tokenizer doesn't properly identify the words (sometimes cuts off the word "massive" to "massiv" and etc.) so now trying with the split function. I've been referring to this page but currently stuck trying to make the function correctly break down the lyrics to different words..Any and all 2c is appreciated.


r/programmingbytes • • Mar 06 '21

Promotion Exposing sequential IDs is bad! Here is how to avoid it | Petre Popescu

Thumbnail
petrepopescu.tech
1 Upvotes

r/programmingbytes • • Mar 02 '21

New Members Intro

1 Upvotes

If you’re new to the community, introduce yourself!


r/programmingbytes • • Feb 25 '21

How do you check if a string contains only digits?

1 Upvotes

r/programmingbytes • • Feb 24 '21

Building a form in Play Framework | Petre Popescu

Thumbnail
petrepopescu.tech
1 Upvotes

r/programmingbytes • • Feb 15 '21

Humor

Post image
1 Upvotes

r/programmingbytes • • Feb 15 '21

Humor

Post image
1 Upvotes

r/programmingbytes • • Feb 15 '21

Looking for someone who can help me improve my problem solving/DSA skills in JS

1 Upvotes

Looking for someone who can help me improve my problem solving/DSA skills in JS

I've been practicing problems on JavaScript for a while now.I'm able to solve some problems easily and having a hard time solving some problems.I'm looking for a study buddy / mentor who can help/guide me.If you're learning/practicing, we can learn together and explain each other things.HMU if you're interested. My timezone is GMT +5:30Thank you


r/programmingbytes • • Feb 15 '21

Simplify boolean variable assignment?

1 Upvotes

Simplify boolean variable assignment?

I'm currently working through the first chapters of Daniel Liang's Intro to Java Programming. Can anyone explain how to "simplify boolean variable assignment" and give some examples? I have googled it but still don't understand how to write the code in (b). TIA!"Common pitfall: Simplifying Boolean Variable AssignmentOften, new programmers write the code that assigns a test condition to a boolean variable like the code in (a). This is not an error, but it should be better written as shown in (b).(a)if (number % 2 == 0) {even = true;} else {even = false;}(b)boolean even= number % 2 == 0;"


r/programmingbytes • • Feb 15 '21

Humor

Post image
1 Upvotes

r/programmingbytes • • Feb 15 '21

Resource to Learn ASP.NET core that is not a youtube project video

1 Upvotes

Resource to Learn ASP.NET core that is not a youtube project video

Hello friends, I have to learn ASP.NET core for my internship. I'm not a beginner, I already know coding and worked on my projects in web before but I just never worked on Microsoft thing before and feeling totally overwhelmed. If you have any resources that could help me, I'll be very happy. thanks.


r/programmingbytes • • Feb 15 '21

Python : Help with Read Text File into List then Sort List on Two Keys

1 Upvotes

Python : Help with Read Text File into List then Sort List on Two Keys

Python : Help with Read Text File into List then Sort List on Two KeysI have a simple text file that has three columns of numbers. My code intends to read the text file line by line as numeric data (not string), assign each line read to a list element. Next I want to sort the numeric data by the first and third columns in the list by ascending and or descending rank magnitude on the third column. This seems like something that should be really simple. Python is not my first language, definitely still hard on the learning curve - but I cant figure out what Im missing here. Spent hours scouring the net, forums for similiar issues and recommend routines but still not able to come up with a satisfactory solution. Any feedback, tips, insights, recommendations welcome. Find attached a copy of the text file as well as the simple current code used. I do not want to use dictionarys, tuples or np style arrays, nor panda or jupyter. Am using Python3.4 and am hoping for a solution using lists that work in my current version. The current code I am using does read the text file, stores it to a list and appears to do something when sorted but the sort is not correct. Previously numbers were being stored in the list as strings not integers or numeric format and that was driving me crazy because when sorting it was sorting in an alpha way not numeric. The current code when sorting does not sort in the described way as needed. I want to have the output to screen shown so that its easy to see three columns displayed line by line, hence the for statement used. Thanks again folks, see below ;CODE :data = []for line in ins:number_strings = line.split() # Split the line on runs of whitespacenumbers = [int(float(n)) for n in number_strings] # Convert to integersdata.append(numbers) # Add the "row" to your list.data.sort(key = lambda x:(x[2], x[0]))for item in data:print(item)TEXT FILE : the file filtered.txt contains rows of numeric data spaced by tabs, each row has threecolumns, here is this simple data :0 128 85 256 125 256 125 256 205 256 205 256 205 256 205 256 205 256 2035 23 1235 23 1235 23 2035 23 2035 23 2035 23 2035 23 2035 23 202 32 142 32 142 32 142 32 142 32 142 32 1417 101 817 101 817 101 817 101 817 101 817 101 834 212 1234 212 1234 212 1234 212 1234 212 1234 212 1234 212 1234 212 129 198 129 198 129 198 129 198 129 198 129 198 129 198 129 198 1238 22 813 234 811 218 836 322 83 222 831 322 1239 111 1439 111 2039 111 1439 111 1439 111 1439 111 1439 111 1439 111 14


r/programmingbytes • • Feb 15 '21

Help with Read Text File into List then Sort List on Two Keys

1 Upvotes

Help with Read Text File into List then Sort List on Two Keys

Help with Read Text File into List then Sort List on Two KeysI have a simple text file that has three columns of numbers. My code intends to read the text file line by line as numeric data (not string), assign each line read to a list element. Next I want to sort the numeric data by the first and third columns in the list by ascending and or descending rank magnitude on the third column. This seems like something that should be really simple. Python is not my first language, definitely still hard on the learning curve - but I cant figure out what Im missing here. Spent hours scouring the net, forums for similiar issues and recommend routines but still not able to come up with a satisfactory solution. Any feedback, tips, insights, recommendations welcome. Find attached a copy of the text file as well as the simple current code used. I do not want to use dictionarys, tuples or np style arrays, nor panda or jupyter. Am using Python3.4 and am hoping for a solution using lists that work in my current version. The current code I am using does read the text file, stores it to a list and appears to do something when sorted but the sort is not correct. Previously numbers were being stored in the list as strings not integers or numeric format and that was driving me crazy because when sorting it was sorting in an alpha way not numeric. The current code when sorting does not sort in the described way as needed. I want to have the output to screen shown so that its easy to see three columns displayed line by line, hence the for statement used. Thanks again folks, see below ;CODE :data = []for line in ins:number_strings = line.split() # Split the line on runs of whitespacenumbers = [int(float(n)) for n in number_strings] # Convert to integersdata.append(numbers) # Add the "row" to your list.data.sort(key = lambda x:(x[2], x[0]))for item in data:print(item)TEXT FILE : the file filtered.txt contains rows of numeric data spaced by tabs, each row has threecolumns, here is this simple data :0 128 85 256 125 256 125 256 205 256 205 256 205 256 205 256 205 256 2035 23 1235 23 1235 23 2035 23 2035 23 2035 23 2035 23 2035 23 202 32 142 32 142 32 142 32 142 32 142 32 1417 101 817 101 817 101 817 101 817 101 817 101 834 212 1234 212 1234 212 1234 212 1234 212 1234 212 1234 212 1234 212 129 198 129 198 129 198 129 198 129 198 129 198 129 198 129 198 1238 22 813 234 811 218 836 322 83 222 831 322 1239 111 1439 111 2039 111 1439 111 1439 111 1439 111 1439 111 1439 111 14


r/programmingbytes • • Feb 15 '21

The Creator of JavaScript was just on Lex Fridman's Podcast

1 Upvotes

The Creator of JavaScript was just on Lex Fridman's Podcast

This interview is all over the place but we're learning about the inception of language we all love! I always thought the "Java" part was just to appease some suits. But there is a much longer and crazier story. What a great interview.https://www.youtube.com/watch?v=krB0enBeSiE


r/programmingbytes • • Feb 15 '21

Looking for backend development study buddy

1 Upvotes

Looking for backend development study buddy

Hey all,I've been coding (non-professionally) in Python for a few years now and am interested in learning how to apply it to backend web development. After looking around a bit, I'm seeing a lot of sentiment toward FastAPI, so I thought that would be a good backend framework to learn.While I have a decent amount of experience with general Python and SQL, I don't have any experience with web development (other than a little bit of very light HTML and CSS work). So the first thing I'm learning right now is asynchronous programming. Then I'll look into how to set up a database (I already know how to write SQL queries, but I've never set up a database). And then I'll try out FastAPI.My goal is to use my Python knowledge to build up a good understanding of the backend. Once I've reached that point (probably quite a while from now), I'll start working on learning frontend development.A couple of points on my learning goals:I'd rather learn things component-wise instead of using a full stack framework like Django as I think this approach will probably help me learn things more deeply.I'm not in any hurry. I'm not doing this so that I can switch jobs, I just think it's really interesting.What I'd like to find is someone who is similarly learning backend development. Not necessarily the same framework, though. Just someone with whom I can talk about what I'm learning (and what you're learning) and who can hold me accountable if I start slacking off. DM me or @ me on the discord server (I'm istol on discord) if that sounds good to you.


r/programmingbytes • • Feb 15 '21

Humor

Post image
1 Upvotes

r/programmingbytes • • Feb 15 '21

Grasping the concept of programming?

1 Upvotes

Grasping the concept of programming?

So im pretty interested in programming and i would say i have beginner knowledge, with basics on what to do. But what are specifics that you have to understand/comprehend to move forward?I know you must learn data structures and algorithms, but is there more beyond that (and obviously the basics of the programming language). And would you also need to relearn data structures and algorithms for different languages? Or is at “as simple” as understanding the concept and altering it for the specific language.Also how much is there one can learn, im probably going too far too early, but say i want to build a small game but also an app, how hard would that be to learn?Is it also quite difficult to learn other programming languages, or would you say once you understand one fully, its quite similar but just learning the syntax (like python, java, c, c++, c#, swift etc)And how do you know which language to use on certain projects, like a website, app or game etc.I know there was a lot of questions but it would be much appreciated if i could have this cleared up!! Obviously its gonna be a big journey and practicing will be better than reading.


r/programmingbytes • • Feb 15 '21

How does a website store the data for the most commonly used "Create New Account" passwords?

1 Upvotes

How does a website store the data for the most commonly used "Create New Account" passwords?

When registering for a new account on some websites and you type a password that is commonly used, it gives you an error to prevent you from registering an account with that password. How do they structure storing those Strings?For example if I type the password Fish12345 it might give the error "Sorry that password is commonly used". Do they break the string apart and search for real English language words like "Fish" and store it inside a database? And when someone successfully creates a new account, they would increment that "Fish" value? And after a certain amount...like 1000 accounts with the password containing "Fish", they would decline account creation using that word?


r/programmingbytes • • Feb 15 '21

I don't want to be decent, I want to be great at programming. Thinking of buying a sub of AlgoExpert to learn and understand data structures / algorithms.

1 Upvotes

I don't want to be decent, I want to be great at programming. Thinking of buying a sub of AlgoExpert to learn and understand data structures / algorithms.

Hey guys,Quick short story of my situation - I am currently a junior full stack developer at a small company. I was placed under a PIP because apparently I wasnt doing so well and taking too long with tickets.I decided to leave the company and start searching for new jobs. I see the easy / medium questions I am given during technical interviews are taking me way too long to complete and I realize that I need a better understanding of programming and what it takes to become a great developer. I also decided to get away from landing a full stack dev job and started teaching myself JavaScript ( ES6 ) and React.js to land a front end developer job.I understand paid resources are generally really great compared to the free ones. I really love having a general layout and roadmap laid out for me so I don't go all over the place when it comes to learning.I started fiddling around with LeetCode and HackerRank but I super curious on AlgoExpert a potential option? Plus its on sale right now for $75 for the whole year / 6 bucks a month roughly.Any advice for beginner programmer looking to become great one day?Thank you!


r/programmingbytes • • Feb 15 '21

made a python TUI!

1 Upvotes

made a python TUI!

I'm a beginner in programming, tinkering on and off with python. I've recently switched to using linux more so usually I only work on a terminal. I liked to make lists to keep track of what I need to do during the day, but it would be a real pain to switch windows, so I decided to make a TUI todo app which you can run along side your normal programming screens. I like using it with tmux.Here's the github repository - let me know what you think, and how I can improve it. I already know there is a lot of scope for improvement! I enjoyed making it, it was a good learning process for me. I was able to learn something new about an obscure library and make something useful out of it (atleast for me lol!)https://ift.tt/3akb2eK


r/programmingbytes • • Feb 14 '21

Where would a .py file be in this mod?

1 Upvotes

Where would a .py file be in this mod?

I am not a modder (learning programming atm in college), but I am trying to alter some code in a mod for dark souls 1, the DS1 Enemy randomizer mod (https://ift.tt/3am4Sep been looking through the source code (https://ift.tt/3rKZ2ci) and am pretty sure I found what I need to modify, but it is in randomizer_rng.py. I don't know how to find that file in the actual mod download, is that something I can access?It certainly isn't listed in the files that I've seen.


r/programmingbytes • • Feb 14 '21

Need help with this project.. cant figure out why it isnt working :/

1 Upvotes

Need help with this project.. cant figure out why it isnt working :/

the second for loop just wont seem to run.. when i run it with the loop commented out.. i can copy and paste the exact same code and it works in console...worked on this for like 8 hours today.. exhausted.. im so sad.https://ift.tt/3afwbH8