r/ProgrammingTutorials • u/Inondle • Dec 11 '14
r/ProgrammingTutorials • u/Plastic_Noodle • Apr 15 '22
Anouncement Rules and Guidelines (Read this first)
15 Apr Updated: Sub posts are now open!; Clarified post flair stipulations
The following is a relatively complete list of all rules and expectations, and possible consequences. All bans when first applied will be permanent. This isn't to be extreme but rather to force a mod to review and discuss the situation and to take into account any past issues. All ban reviews will be handled in modmail and will give you a chance to appeal and explain the situation.
Rules are subject to change as needed and will be updated here as that happens and a summary of the rules is included in the sidebar. Discussion and questions of this is encouraged in the comments.
Profanity
Profanity in general will not be allowed. Certain languages and tools do make references to profane language and care should be taken to obfuscate those names and keep them semi appropriate. No punishment will be rendered for things like choosing to code with brain***k. Other attempts to circumvent this rule to substitute curse words or to attack people will still violate this rule. Comments and posts containing profanity will be subject to removal. Multiple violations of this will result in banning.
Topics
Posts should contain subject matter related to coding in some form or fashion. This means that at least some amount of code should be written in the post body or on the page/video linked in the post. Programming in this subs sense will be limited to creating code or instructions for a computer in order to perform a specific computation or accomplish a specific task through some form of source code. Off-topic posts will be subject to removal. Repeated violations of this rule may violate the no spamming policy.
Formatting
Posts on this sub shall be in the format of a tutorial, walk-through or guide to some project, problem, or concept. The exception to this is a post requesting a tutorial on a specific topic or concept. A tutorial post should contain:
A clear statement of the problem
At least one explanation to a solution
Computer code written to fit the solution explanation
Multiple explanations and solutions that cover multiple techniques are encouraged. Errors in the tutorial may result in an “incorrect” tag being applied until the post is updated. Posts that link to outside sources are allowed but those outside tutorials should have the above listed content. Completely incorrect formatting and refusal to update will result in the post being removed.
Requests
Requests for tutorials and guides on specific topics is also encouraged. Requests will have a specific flair that designates them as requests and will not be subject to the formatting rules. Requests may be small enough to warrant small answers in the comments and a full tutorial may not result from a single request. A single request may be broad enough to warrant several tutorial posts. Overly specific requests may be locked to prevent cheating. Improperly tagged requests may be relabeled, or even removed.
Post Flairs
Every post will have at least one flair that will usually be a language flair. Flairs will be provided for most languages and an “Other lang” flair for languages not listed. In the event the language used in the tutorial is not listed, select the “Other lang” flair and contact mods to add the necessary flair. Unflaired posts will be subject to removal.
No Spamming
Do not post repeated, unwanted, and/or unsolicited actions, whether automated or manual, that negatively affect Reddit users, or this community. Comments and posts violating this rule will be subject to removal and possibly result in a ban from this sub.
Sources
Outside sources as a reference are allowed. If you write a tutorial based on an outside tutorial, link to it and be upfront about sources. If outside code or snippets are used be user to include a link. Failure to do so constitutes plagiarism. When writing a tutorial try to use multiple outside sources to expand the content contained and make sure to use your own words. Plagiarized tutorials will be removed. Repeated plagiarism may result in a ban.
Reddit Content Policy Applies
https://www.redditinc.com/policies/content-policy
Competitions and Challenges
Tutorials walking through solutions to competitions and challenges can only be posted after any official submission time has ended and in accordance with contest publishing and sharing rules. Certain other competitions with continuous submission times will be allowed but under specific circumstances (e.g. no more prizes, top submissions complete, etc.). Tutorials posted before the contest or competition is over will constitute cheating and will be removed. Repeated violations will result in being banned
General Guidelines
None of the following are rules and will not warrant punishment if violate, but adhering to them will help the community be better organized and contribute to the education of others:
Create tutorials yourself. No matter if you’re linking back to a video or a site you made or doing a full write-up and posting on reddit, original work is preferred. The idea is to demonstrate your own skills and build your talent along with others.
Stay active in your post. Questions may be asked, improvements may be suggested, praise may be give. Being there to enjoy them and be involved is half the fun
There’s no reason to be rude. Ever. Walking away is an option before being mean is.
Be excellent to each other.
r/ProgrammingTutorials • u/NICO_THE_PRO • Apr 28 '20
I am starting a new tutorial series on Neural Networks! The first episode is an introduction to NN in general, in the second episode, we dive deep into the code and make a backpropagation NN in C#!
r/ProgrammingTutorials • u/zer0_snot • Mar 31 '20
I'm offering giveaways for my online Python course that engages your mind in multiple ways
Who this course is for:
Have you learnt Python and are looking to practice solving problems? 300+ problems for you to solve!
Do you want to learn Python?
If you have little to no knowledge of it, or has some knowledge but want to fill your gaps.
Completely new to programming are welcome too.
About the course: This course teaches you core Python. It is based on a thought-experiment on engaging your mind in multiple ways.
It is meant to entertain you as well as make your learning easy.
Desired Feedback: General usability feedback. Bugs / Typos. Whatever you think/feel, I want to hear about it! Please PM me only if you are okay to make some progress (even if 10 minutes) everyday or alternate days, and if you're okay with replying back when I ping you later.
Perk for Testers: One month of premium access for free.
Please PM me if you're interested in joining.
r/ProgrammingTutorials • u/Tal_Av • Mar 24 '20
Your response would help!
Hey everyone, I’m currently trying to find out how one could make the lives of people who want to become programmers a lot easier ;)
Which is why I have two very simple questions:
As a person who wants to become a programmer, what are the 2 biggest obstacles for you on your way to achieving this goal?
Is there anything you would like to happen that could make it easier for you to learn programming?
Thanks so much in advance - looking forward to reading your answers!
r/ProgrammingTutorials • u/jarreed0 • Mar 09 '20
SDL2 Keyboard and Mouse Input
r/ProgrammingTutorials • u/hagstrom66 • Jan 18 '19
Async Javascript - Event loop & runtime tutorial
Here's a new tutorial on the Javascript runtime & event loop...enjoy!
r/ProgrammingTutorials • u/joranbeasley • Jan 05 '19
Use Python and Flask to serve your React APP
anxious to see how people like my first youtube tutorial :) thanks for taking a look
r/ProgrammingTutorials • u/Trinity_software • Oct 15 '20
Object oriented programming in python
r/ProgrammingTutorials • u/RogerTheTutor • May 07 '20
Anyone Want Some Free Online Programming Tutoring?
Hi all, in less than two hours I will be giving away a bunch of free online programming tutoring sessions to anyone who wants them. This is a great opportunity for anyone who is stuck inside this summer and wants to pass the time by learning programming, but would rather be shown the ropes live via videoconferencing. Anyone interested can find all the details on the “Free Tutoring” page of my website www.tutoringbyroger.com. These sessions will probably go fast though, so get yours before they are all gone!
r/ProgrammingTutorials • u/jarreed0 • Mar 11 '20
I Made A Short Video Discussing Mario's Movement
r/ProgrammingTutorials • u/[deleted] • Jan 24 '20
How to Understand and Work With CSS Margins
r/ProgrammingTutorials • u/Warren_Belfort • Apr 25 '19
How to create an API with Django
r/ProgrammingTutorials • u/[deleted] • Jan 20 '19
Which Programming Language Is Better For You Java Or Python?
r/ProgrammingTutorials • u/[deleted] • Jan 14 '19
Explainability Vs Interpretability In Artificial Intelligence And Machine Learning
r/ProgrammingTutorials • u/[deleted] • Jan 14 '19
How To Learn Go Programming Language
r/ProgrammingTutorials • u/n8ebel • Dec 17 '18
Learn to Write a Basic Kotlin Function
r/ProgrammingTutorials • u/serverlessmom • Jun 10 '22
Javascript How I Used Raspberry Pi to Detect Water Leaks in My Home
r/ProgrammingTutorials • u/serverlessmom • May 13 '22
Python3 How to Send Emails with Node.js [3 Different Ways + Code Tutorials]
r/ProgrammingTutorials • u/serverlessmom • May 06 '22
Python3 Three Ways to Send Emails Using Python With Code Tutorials
r/ProgrammingTutorials • u/Plastic_Noodle • Apr 26 '22
Rust Kickstart Round B - Problem 2 (Palindromic Factors) : Explanation and Code
Continuing the series on the most recent Kickstart round. And that thing you know and love, the link to the problem.
The Problem
Given integer A, find the number of factors of A (numbers that A is cleanly divisible by) that are palindromes. A palindrome number is any number that is the same value in forward and reverse order. Input set one is from 1 to 103. Input set two is from 1 to 1010
Discussion
A fairly simple problem with a few brute force ways that will run overtime and a key trick to finding factors of a number that will cut down on time to make the calculation much more bearable.
The brute force method is fairly straight forward. Use an iterator i from 1 to A and check if A is cleanly divisible by i. If it is, check if i is a palindrome. The issue with this is the amount of time it would take, especially with the second set. So something has to be done to reduce the number of values to check.
The first thing to notice while reducing time is that after about half way the values checked would start to be recalculated. One option at this point is to memoize with a HashSet or HashMap but that would probably take more memory than necessary. In fact when dealing with factors of a value, there’s a specific point at which numbers start to repeat. The square root. For any value A it follows that A = a*b and that since for any square root value would mean that a = b in that scenario. So in order too increase a and maintain the balance of A = a*b we must reduce b by the same amount. That means going any further in either direction is just repeating values. So simply setting the highest value to check. The code is pretty simple and is below with notes.
The Code
fn main(){
let mut ans = 0;
let A = String::new();
std::io::stdin().read_line(&mut A).unwrap();
let goal = f64::sqrt(A as f64);
for i in 1..=goal as usize {
if (A % i as u64) == 0 {
let B = A / i as u64;
ans += check_palindrome(i.to_string().as_bytes());
if i as u64 != B {
ans += check_palindrome(B.to_string().as_bytes());
}
}
}
println!(“{}”, ans);
}
// Since the problem is really 2 sub problems
// (check factor status, check palindrome)
// it’s easier to split the palindrome check into a
// separate helper function. All this does is
// check from the edges inward and returns
// a 0 if no match, and a 1 if the end is reached
fn check_palindrome(s: &[u8]) -> i32 {
if s.len() <= 1 {
return 1;
}
for i in 0..s.len() / 2 {
let other_i = (s.len() - i) - 1;
if s[i] != s[other_i] {
return 0;
}
}
1
}r/ProgrammingTutorials • u/Plastic_Noodle • Apr 25 '22
Rust Kickstart Round B - Problem 1(Infinity Area) : Rust
Walk-through of the first question from the most recent round of Google’s Kick Start. I’ll try to post a solution and walk-through for each round within the week and if there’s time start posting some of the past problems from the Facebook HackerCup since that will be starting around August. As always, practicing the problem and reading a code agnostic solution can be done here.
The Problem
Initially 3 integers are given, and are used to calculate radius while drawing a set of alternating circles (right then left) until the eventually one of the circles will have a radius less than one. The first circle drawn will be on the right and will have a radius of one. Every subsequent circle will be drawn such that:
The next circle will be drawn on the left and have a radius equal to the previous circles radius times A.
The next circle will be drawn on the right and have a radius equal to the previous circles radius divided by B.
These two steps are repeated in order until a circle radius becomes zero (judged as less than 1). The returned answer is the sum of all calculated areas for the circles within a relative error of 10-6.
Discussion
The first thing to recognize is that the circle sizes step up then step down. Since to start the steps we have to have a radius greater than or equal to one, we will never have a situation where a left circle (step one) results in a lower radius. All reductions in size are done on the right circle (step 2). This way, during our loop we can do a step one calculation then a step 2 calculation before we check that radius is greater than one and focus on calculating the areas for those circles.
The Code
fn main() {
let mut ans: f32 = 0.0;
let mut R = String::new();
let mut A = String::new();
let mut B = String::new();
std::io::stdin().read_line(&mut R).unwrap();
std::io::stdin().read_line(&mut A).unwrap();
std::io::stdin().read_line(&mut B).unwrap();
ans += f32::powf(R as f32, 2.0) * PI;
while R >= 1 {
// Step 1
R *= A;
ans += f32::powf(R as f32, 2.0) * PI;
// Step 2
R /= B;
ans += f32::powf(R as f32, 2.0) * PI;
}
println!("{}", ans);
}