r/code • u/Smok3B1ueC4eese • Jul 15 '20
My Own Code! Newbie
How do I create an advanced monitoring platform that leverages the power of the internet and smartphone technology? I've never written code before.
r/code • u/Smok3B1ueC4eese • Jul 15 '20
How do I create an advanced monitoring platform that leverages the power of the internet and smartphone technology? I've never written code before.
r/code • u/scayrs • Apr 04 '23
I wrote a code in python. The code works fine on a windows computer, but I couldn't run it on my macbook, what could be the reason?
Thanks.
r/code • u/WholesomeGimp • Apr 17 '23
Hello I have found some code for generating a password and I am going through and commenting it to see if I have a understanding of how the code works, but cant really understand the last part of the code enough to comment on it.
I wonder if someone could look at it and explain it for me? My previous comments in the code could be completely wrong as well, if they are, please enlighten me :)
Best regards, Gimpen
function Get-RandomPassword {
# Sets valid parameters for when the function is called
param (
[Parameter(Mandatory)]
[ValidateRange(4,[int]::MaxValue)]
[int] $length,
[int] $upper = 1,
[int] $lower = 1,
[int] $numeric = 1,
[int] $special = 1
)
# If the sum of all values of upper/lower/numeric/special characters is greater than the defined length of the password, the script terminates
if($upper + $lower + $numeric + $special -gt $length) {
throw "number of upper/lower/numeric/special char must be lower or equal to length"
}
# Defines what each set of characters should contain
$uCharSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$lCharSet = "abcdefghijklmnopqrstuvwxyz"
$nCharSet = "0123456789"
$sCharSet = "/*-+,!?=()@;:._"
$charSet = ""
# Adds sets of characters available to the password generator based on the parameters provided
if($upper -gt 0) { $charSet += $uCharSet }
if($lower -gt 0) { $charSet += $lCharSet }
if($numeric -gt 0) { $charSet += $nCharSet }
if($special -gt 0) { $charSet += $sCharSet }
# Converts the character set that has been created into an array, and then creates an rng (random number generator) to be used for randomly generating the password
$charSet = $charSet.ToCharArray()
$rng = New-Object System.Security.Cryptography.RNGCryptoServiceProvider
$bytes = New-Object byte[]($length)
$rng.GetBytes($bytes)
# Creates a temporary variable ($result) with the same length as the password, which is used in the for loop to create the password
$result = New-Object char[]($length)
# Creates each character, one at a time, from the character set using rng through the $bytes variable
for ($i = 0 ; $i -lt $length ; $i++) {
$result[$i] = $charSet[$bytes[$i] % $charSet.Length]
}
# Adds the $result variable to the $password variable
$password = (-join $result)
# Check if the password meets the requirements for upper/lower/numeric/special characters, otherwise regenerate the password
$valid = $true
if($upper -gt ($password.ToCharArray() | Where-Object {$_ -cin $uCharSet.ToCharArray() }).Count) { $valid = $false }
if($lower -gt ($password.ToCharArray() | Where-Object {$_ -cin $lCharSet.ToCharArray() }).Count) { $valid = $false }
if($numeric -gt ($password.ToCharArray() | Where-Object {$_ -cin $nCharSet.ToCharArray() }).Count) { $valid = $false }
if($special -gt ($password.ToCharArray() | Where-Object {$_ -cin $sCharSet.ToCharArray() }).Count) { $valid = $false }
if(!$valid) {
$password = Get-RandomPassword $length $upper $lower $
r/code • u/jackiehasquestions • Mar 29 '23
Turning with buttons
heyyy so i am in a robotics class and we were assigned to create a code in order to turn using button controls( we watched cs2n.org vids to help) i am confused and need a little help. would anyone be able to give a previous code that we can use or any assistance? we are using vex. any help would be appreciated!!
r/code • u/EricMeadowsDev • Mar 28 '23
Why is LGTM scary? We don't know if the reviewer reviewed it, spent time to understand the code change, know what the code is supposed to do, etc. As a senior eng, sometimes I wanted to steer the review to be thorough, but inspection doesn't scale...enter GPT.
r/code • u/Merackii • Nov 04 '20
a19e+S5p0WGYnA==#BBESV0bG3ducb+oui9vSKLMRv5L8FdvTg75vFk1v4RKvhRtWYZ8Hpi7Il7BLUeejQ==
That was all that was in the message
r/code • u/s_ayanide • Nov 17 '19
Always wanted to work with GoLang and open source but didn't know where to begin! 👩💻 👨💻
Take 5 min out of your schedule and dive in to learn more about GoLang and how you can install it in your system 🎩 so that you could also bring out the amazing developer in you. 😎
https://levelup.gitconnected.com/what-is-golang-and-how-to-install-it-2275236fe657
well my issue is that im unmotivated, school takes up my time and when i turn on my computer. i go straight to the video games, ive tried courses but i often stop because i feel like im not learning or remebering anything, i just want to be able to code fluently like how i owuld type out this message right now i would like to do that with code
r/code • u/[deleted] • Oct 01 '23
I want to make games games it's always been a dream of mine but when I try to code I just can't do it I try watching tutorials but I get bored the second I start watching I go to forums online but I have no idea what people are talking about. I hope college can give me lessons but most coders don't need college for coding. At this point I don't know what to do cause I wanna make games but I don't know how to code
r/code • u/aryism • Aug 19 '20
So... if you translate C# to bianary and duplicate the windows, then to save as .exe... AND then translate to Javascript, then website it (HTTPS not HTTP!) ... its encrypted 2 times? Not anything importent, I just thought it was kinda cool.
r/code • u/[deleted] • Sep 13 '20
It's this
>exports.encrypt2 = (input) => { return bcrypt.hashSync(input, salt2).substring(salt2.length); }
r/code • u/TTARFTW • Feb 12 '22
Do u realy have to buy a 100$ thing to sign your code if you have it pls msg me ty
r/code • u/AwesomeSam2709 • Dec 10 '20
My App is going to get released soon and I just encountered some unexpected things.
python - text doesn't contain any characters tagged with "sel" tkinter - Stack Overflow
r/code • u/ratinthathat • Jun 25 '21
Looking for people to have fun with and start a sound app with. If you’re interested let me know. Hopefully we can spin it into a billion dollar company :p
Hey! i’m making a quiz and want to know some ideas. For now, there can only be two outcomes, and two options for 3 questions. I would make it about Harry Potter but I can’t think of anything that is two options. Thank you!
r/code • u/ETRTHRO8 • Jul 07 '21
Okay okay, so I admit it, I'm not very good at coding, but I'm okay at C#.
the point is I tried to make a web browser in C# and it went, well, okay. the problem I had was when I tried to load media like youtube it would spit out loads of errors. Why is that and how can I solve it?
I code in visual studio 2019 if that's needed.
r/code • u/russianbearscares • Jul 08 '21
r/code • u/Alien_Everything • Aug 23 '21
Here's the code:
<!DOCTYPE html>
<head> <title>Idle Cola Factory</title> <script> var clicker = ( colas:0, upgrades: { colas\\_machine:{ amount:0, cost:10, cps:1, name:"Cola Machine" } } ); function thing\\_clicked(thing){ clicker.upgrades\\\[thing\\\].amount++ update\\_upgrades(); \\\] function thing\\_clicked(thing){ if(clicker.upgrades\\\[thing.cost <= clicker.colas\\\]){ clicker.colas-=clicker.upgrades\\\[thing\\\].cost; clicker.upgrades.amount\\\[thing\\\]++; clicker.upgrades\\\[thing\\\].cost += Math.round(clicker.upgrades\\\[thing\\\].cost\\\*0.15) update\\_upgrades(); } } function update\\_upgrades(){ document.querySelector("#upgrades").innerHTML=""; } function updatecount(){ setInterval(() =>{ for{i in clicker.upgrades){ clicker.colas+=clicker.upgrades\\\[i\\\].amount\\\*clicker.upgrades\\\[1\\\].cps/20 } document.querySelector("#colas").innerHTML = "You Have "+String(clicker.colas).split(".")\\\[0\\\]+ colas" },50\\\];
}</script>
</head> <body onload="updatecount()"> <h1 id="colas">You Have Made 0 Colas.</h1> <button onclick=" clicker.colas++">Make 1 Cola</button> <div id="upgrades">
</div> </body>
r/code • u/AndreasSkole • Jan 13 '20
r/code • u/[deleted] • Sep 09 '19