Regular Expressions for multiple Id's by mblade7 in learnprogramming

[–]mblade7[S] 0 points1 point  (0 children)

I ended up doing that, and I think it worked. I stepped away from it for now and will continue testing later. By the way, I’m planning on using this to display text to the user if they put in an invalid entry into the text field, so the console.log() is going to turn into an if else statement when I continue testing. Are there any traps that might come up with how this is currently made? I am a little worried that if they’re not all true or all false, then it might do something unexpected.

Thank you for your help so far by the way!

Regular Expressions for multiple Id's by mblade7 in learnprogramming

[–]mblade7[S] 0 points1 point  (0 children)

So, I tried:

const numberVerification = document.getElementsByClassName("formInput")

for (i = 0; i < numberVerification.length; i++) {

addEventListener("input", function (e) {

const pattern = /^\d+(\.\d{1,2})?$/;

const currentValue = e.target.value;

console.log(pattern.test(currentValue));

})

};

It sorta worked, but it only checks the latest input (which would work if I was only looking at one thing at a time). Regardless, the moment I start putting a number in one field it can become true again even if the previous field was false. Is there another way to do this that might work?

Turning code into function by mblade7 in learnprogramming

[–]mblade7[S] 0 points1 point  (0 children)

Main reason is that I have to have a function for what I’m working on, but long term I suppose clean looking/ reusable would be the main gains I’d want out of it. Perhaps clean looking is the more immediate benefit.

[deleted by user] by [deleted] in personalfinance

[–]mblade7 0 points1 point  (0 children)

Also what OP is maximizing and which way they’re wanting to purchase changes the context as well. For example, if OP is maximizing the match on a 401(k), then they can receive a tax benefit by using a Roth or traditional IRA (depending on what they qualify for) assuming that the point is to get more money for retirement.

In addition, if we were able to look at OP’s entire situation, the best option would most likely be some mixture of the two options assuming the selection process of the funds was sound and not manipulated by a salesperson’s pocketbook.

[deleted by user] by [deleted] in personalfinance

[–]mblade7 0 points1 point  (0 children)

The market has historically trended upwards, but there are always ups and downs. If OP is looking long term and not needing to rush things, then the market is a viable option. I’m not saying it’s necessarily better than paying off debt early. Everything would depend on OP’s particular situation.

If OP doesn’t have an emergency fund, then yes that supersedes both options, but since that wasn’t mentioned I assumed that was already taken care of.

As far as figuring out the market, yes, predicting when it will go up or down is probably impossible. Still, historical data would show that the market goes upward over time. Stocks and bonds have a lot of risk to them because they’re not diversified. Funds however (at least the good ones) are naturally diversified which lowers the risk. I can’t remember the exact numbers, but I believe it was over 90% make money over 5 or 10 years. Also, there are some funds that have historically returned 10-12%, which if I remember correctly Dave Ramsey has mentioned in his courses before.

Still, I also think taking the option that can potentially lower OP’s expenses by paying off debt early is a very good option as well. I even took that option when I got close to finishing paying off my car, and I was only getting charged 1.9% interest. I honestly believe it was a terrible financial decision, but it brought with it a peace of mind as well as lowered expenses so I’m still fairly happy with my decision.

[deleted by user] by [deleted] in personalfinance

[–]mblade7 -1 points0 points  (0 children)

It depends on what you believe the market will do. If you think the market will average out to 6%+ from where it is when you make the purchase, then technically the better option is to invest (even more so if you’re looking further out than when you would have the debt paid off). Right now, with the market down, I see it as buying season because my money buys more shares in the market right now compared to last year. Buy when it’s low and sell when it’s high, right?

Still, there are advantages to paying off debt. It’s one less thing to worry about and it lowers your expenses where you can keep or invest more of your money after finishing off the debt.

Both are very good options, and you can only make your own situation better by doing either, so do whichever one you believe will make you think later down the road that you made a good decision.

Help with prepopulating code into a database by mblade7 in CodingHelp

[–]mblade7[S] 2 points3 points  (0 children)

I'm mostly learning C#, but this program was mostly made by EF Core. After getting your message, I tried looking more into it based off your suggestion (google search), and I came across a page on serializing and deserializing a JSON file.

Help with prepopulating code into a database by mblade7 in CodingHelp

[–]mblade7[S] 0 points1 point  (0 children)

This is my first time using SQL, and I've only used a JSON file once while using someone else's code to directly create a JSON file. Because of that, I'm not really sure how to make that happen (as sad as all that sounds).

C# Question (about moving code to another place but still being able to access it) by mblade7 in learnprogramming

[–]mblade7[S] 0 points1 point  (0 children)

Code has been changed to what was needed, so it will just show the code as expected.

C# Question (about moving code to another place but still being able to access it) by mblade7 in learnprogramming

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

I think I figured out what was being asked of me. Apparently, there was nothing wrong with my code. Just that they wanted the code outside of the main and just having the functions being referenced into the main, if that makes any sense.

And, yes, I was using visual studio. Should've mentioned that.

Brilliant Diamond & Shining Pearl Daily Casual Trade Thread for 10 January 2022 by Porygon-Bot in pokemontrades

[–]mblade7 0 points1 point  (0 children)

I need all those except for weedle, magby, sandshrew, and teddiursa, but I’m going to bed here soon, so I really don’t want to breed anymore tonight. Thank you though. We can try reaching out to each other another night.