Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!

gary werber

Greenhorn
+ Follow
since Jul 22, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
14
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by gary werber

Hello, I have a loading bar I made in JS that loads based on how many hours the user adds to their itinerary.

The current version of the loading bar can be viewed here: 50 things port henry

The particular problem I'm having is when it comes to rounding the loading bar width after the calculation.

The current code takes the hourly value associated with each button and creates a percentage that dictates the loading bar's length. However there is a rounding error associated with the calculation that causes the loading bar to not always match the length exactly.

Here are the most important snippets of code:

This section of code is responsible for getting the hourly value from the "add to itinerary" button.



The set duration function which sets the loading bar's length.



I tried performing this calculation without any rounding and got loading bar errors. I've tried rounding the result to the nearest integer and the nearest multiple of 5. I still get issues, particularly when the loading bar is being shortened, which is the exact same calculation just inverted.

Some other issues:

1. On the live website, the hover effect and clickability don't register on all of the buttons. I've tried inspect element and can't see any different between the buttons that work and dont.

2. If I press one itinerary button quickly, I'm able to bypass the maximum allowable hours. For example, if the max itinerary is 10 hours, if I click the button very quickly I can have activities totalling over ten hours. I don't understand why the pace of the clicks matters when it should be going through the if else loop every time.
I needed to build this website ASAP so I used what I had known up until this point which was JS DOM manipulation.

I'm diving into React now, and I guess I'll use this thread as an opportunity to clear something up. Most of the tutorials use create-react-app, which seems to be some kind of simplified tool for making one page react apps. If I wanted to go more indepth and use the whole library, what would be the NPM import and how do I integrate that into a web development project.

Thanks in advance,
-gary
I have a JS function that needs to extract the heading inside of a div box. The div box contains the button that fires this action. In a previous version of the code, the div just contained a heading, paragraph, and the button. So all I had to do was set the button's class to active and select the previous sibling.

However, the div is beginning to fill up and I'm having to list a lot of previous sibling calls, and it no longer grabs the correct element. Here is the code below:






Is there a way to grab a sibling via its tag?
I was going to get to the GUI output when the rest of the code worked. And my eventual idea was to navigate from textfield to textfield using arrow keys or WASD so that values could be entered quickly. I figured the output should also have a session history that displays all of the values you computed for easy reference in your calculations.
10 months ago
Okay, got it to finally work.
Might bother to make this more consice in the future.
Thanks for all the help.
Here is the final working code:







10 months ago
Looking at my main program now I see why I did it the way I did.





Whats a workaround for this?

This program also doesn't work, and yes I plan on adding an exception checker to my calcFunction.
10 months ago
So this piece of code worked:





And so did this:





I take it the bottom one is safer.
Sometimes I let Matlab'isms sneak into my code logic.
Thanks for the help.
10 months ago
I'm not sure that I follow, I'm not very familiar with casting types yet.

-thanks
10 months ago
Trying to build an interpolation calculator that takes inputs from textfields and then displays the answer. I'm having trouble getting my textfield's value to convert properly to double. Here is the minimum reproducible example.









If I enter any arbitrary number, 75, 7.5, .75 and press enter I get 0.0 as my return, and the exception handlers work properly.
10 months ago
Hello,

I've been searching around Amazon for books on Java's 3D API. Most seem to be from early 2000's, are they sill relevant or will it be a headache?

Thanks.
1 year ago


that solved the issue, hopefully the program runs as I expected.

Thanks guys.
1 year ago
So I would declare it at the top of my class?
1 year ago
Okay, is there anyway to access the accountinfo from the accountsearcher method?

The text document is a list of bank account names. Bank account names are created via the account name generator, which takes the person's username and password and merges it into an account name.

Ex: username: bob     password: 1234      accountname =  bob1234

So therefore:
If you want to see if an account exists, you type the username and password, the accountname generator turns it into an account name which is our search query. The program then searches the arraylist for the account name (search query)

This section of the program loads the list of account names into an array list. Via methods this arraylist is searched and modified. I want these actions to be performed via a method that can be called
from other parts of the program.

1 year ago
Hello,

I'm not sure that I'm doing this in the most efficient way, but what I'm trying to do is have a method that searches an arraylist which can be called from another class.

I'm getting the error: "symbol accountinfo not found" Line: 39

Note: All imports have been excluded to save space.

Here is the minimal reproducible example:


1 year ago
Hello,

I recently finished a genealogy program project that helped me reinforce my understanding of classes, objects and methods. However when I look at this program, it looks like something I could have done much more easily with a functional programming paradigm approach.
In other words, the classes I had where simply there because I was doing it the Java way, when I could have done the exact same thing in Matlab without classes. My next couple of projects are going to cover arrays, array lists, and some other Java fundamentals. However, after
I complete these, I'm looking for a project that really requires a solid understanding of OOP to execute correctly. I saw someone suggest creating a minesweeper clone, but will that mean I have to go in depth into Java GUI's before I attempt this project? I'm looking for any suggestions
for OOP heavy projects or if you think minesweeper fits the bill.

Thanks,
1 year ago