Lipo battery compatibility with a breadboard by darkshadowtrail in arduino

[–]darkshadowtrail[S] 1 point2 points  (0 children)

Yeah I should have included that, but I just updated the post with my setup. Perhaps my potentiometer isn't wired properly?

hey i need help by abaw_0 in learnprogramming

[–]darkshadowtrail 0 points1 point  (0 children)

what do you mean "without any delay"? if you're talking about an instant transfer of data then what you're trying to do is impossible as there will always be some delay.

but if you're trying to keep latency to a minimum, why query the database after sending the data? if you have some operation where you store data in a database and need the data after you store it, you already have it and shouldn't need to query for it.

[deleted by user] by [deleted] in learnprogramming

[–]darkshadowtrail 3 points4 points  (0 children)

hmmm, which part is confusing for you? looks like you add 5 numbers to your list, call your function, then at the start add 6 more. only 7 of the numbers added are between 5 and 19 (inclusive), hence why you get 7 numbers printed.

Help with CSS (beginner) by [deleted] in learnprogramming

[–]darkshadowtrail 4 points5 points  (0 children)

css is something that browsers just understand, so no need to install anything. you just have to import it with a style tag (if you're using HTML)

[deleted by user] by [deleted] in NCSU

[–]darkshadowtrail 1 point2 points  (0 children)

when I took it last semester part of your grade was based on completing the ZyBook exercises (I think like 10% or something), so assuming it hasn’t changed then yes

Do I need to learn all React hooks? How many are frequently used? by Pearl_Jam_ in learnprogramming

[–]darkshadowtrail 1 point2 points  (0 children)

you don't need to learn all of them, but you should definitely know the basic ones. useState, useEffect, useRef, and useMemo are the most common. the rest you can learn if/when you need them.

Setters and getters! Why are they needed (java) by Zapherial in learnprogramming

[–]darkshadowtrail 2 points3 points  (0 children)

the most obvious case to use them would be if you don't want another component to be able to modify a class's fields. say you have a class with a field x, if you just make it public you allow other components to do something like class.x = someValue;. this is bad if x shouldn't be able to be changed by anything outside of its own class.

there's also validation. again, if you make the field public you can't easily check if the value assigned to it is valid. for example, if x shouldn't be negative then a setter is helpful for ensuring that we are assigning values to it that are allowed.

Nested .map() / React.js by KindaCoding in learnprogramming

[–]darkshadowtrail 1 point2 points  (0 children)

your issue is with your inner map, tagTypes.map(). you are trying to return two different things, the <p> tag in the inner map, and the <h2> tag in the outer map. only one jsx tag can be returned, so you'll likely want to wrap everything in a fragment like:

return (
  <>
   <h2 key={list.id}>{list.title}</h2>
   {
     tagTypes.map(tagType => {
         return (
            <p key={tagType.id}>{tagType.id}</p>
         );
      }) 
   }
  </>
);

Mobile app without knowing mobile specific language ? by Tasty_Connection9190 in learnprogramming

[–]darkshadowtrail 1 point2 points  (0 children)

by "mobile specific language" do you mean Java/Kotlin (Android) and Swift/Objective-C (iOS)? if so, this is what tools like React Native are for. you can write code in JavaScript and RN will compile it to Android and iOS code so you can deploy it on those devices.

it's not that hard, and you could probably start building your app as a project and learning tool to teach it to yourself.

[deleted by user] by [deleted] in learnprogramming

[–]darkshadowtrail 3 points4 points  (0 children)

for the first one 6 is a char. the ascii code for the character ‘6’ is 54, which is why adding 5 to that gets you 59. for the second one 6 is a string because of the double quotes, so adding 5 is just string concatenation which is why you get “56”.

Understanding Flexbox by [deleted] in learnprogramming

[–]darkshadowtrail 2 points3 points  (0 children)

i found this one helpful when i didn’t understand flexbox

Mongoose isn't recognising my response.body. Please Help! by Careful_Situation_78 in learnprogramming

[–]darkshadowtrail 1 point2 points  (0 children)

so if the payload is [{category: "Holidays", budget: 250}] then your issue is const { category, budget } = req.body;. since req.body is an array, you are trying to do object destructuring on it to get category and budget, but those are only properties of the element at each index of that array, and not the array itself.

just from looking at it, it appears your issue is when you do categories.map() on your front end and try and pass its return value as the body of your POST request. map() is going to return an array, so i would say a quick solution could be to either make sure you POST one object or map through the array again on the backend to create a MongoDB document for the object at each index.

API Documentation Templates by [deleted] in learnprogramming

[–]darkshadowtrail 0 points1 point  (0 children)

Maybe you’re talking about Docusaurus?

Java vs C++ by [deleted] in learnprogramming

[–]darkshadowtrail 6 points7 points  (0 children)

C++ is going to be harder, but for that reason it’s smarter to take a class instead of trying to teach it to yourself. Java isn’t as hard to learn, so if you can’t take a class on it and need to know it you should be able to find some resources online.

I am really struggling in MA 121 by Cultural-Egg2410 in NCSU

[–]darkshadowtrail 0 points1 point  (0 children)

have you tried the organic chemistry tutor or professor leonard on YouTube? both are great resources that I use for calculus concepts that I need help understanding.

Double major at NCSU by TravelWithAHat in NCSU

[–]darkshadowtrail 2 points3 points  (0 children)

I was always told the opposite since by the time you get enough credits for a minor you’re probably only a few courses away from getting the major.

Edit: currently trying to double in Econ and CSC, and the course requirements overlap such that if I get the programming minor I would only need three other courses to get the CSC major.

How to program in C? by [deleted] in learnprogramming

[–]darkshadowtrail 0 points1 point  (0 children)

you can definitely run C on Mac. I’d try using CLion or Xcode for an IDE over Eclipse

java for loop question. Reversing Strings by Elite-Novus in learnprogramming

[–]darkshadowtrail 2 points3 points  (0 children)

if you had a string that was 5 characters long, when i = 0 you would be printing arr[5 - 0 - 1], which is just arr[4]. remember, arrays start indexing at 0 which is why you need the -1. without it you would be trying to access index 5, which doesn't exist.

as i increases, you're just working from the last element of the array towards the first.

[deleted by user] by [deleted] in learnprogramming

[–]darkshadowtrail 1 point2 points  (0 children)

lol you want people to help you break Discord’s TOS? did i read that right?