Anakela Bella

Ranch Hand
+ Follow
since May 24, 2014
Merit badge: grant badges
For More
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anakela Bella

Bear Bibeault wrote:jQuery is a JavaScript library -- not something different from JavaScript. But I understand your approach.


Got it! That's how new I am to this whole thing. Haha... Thanks again!

Bear Bibeault wrote:Any errors in the JavaScript console?

Btw, the document.forms style of notation is very old-fashioned.

And, why aren't you using jQuery to make all this much simpler?


Hi, Bear. Thank you for your reply! I am actually going very old school and coding this in a text editor. I just used DirtyMarkup to clean up the code, and got several "unclosed string" errors beginning at variable r. It turns out I had either too many or too few quotation marks, and that's why the code wasn't working! Thank you for having me look for errors! The working code is as follows:



As for why I am doing this in JavaScript as opposed to jQuery, I am trying to learn JavaScript before I jump into jQuery for the sake of learning it, I suppose.

Jeanne Boyarsky wrote:What jumps out at me is this code:



\n is a character that goes inside a string. For example:
"Thank you for your message! Is the following info correct?\n"
or
lastNameValue + '\n'


Thanks for your reply, Jeanne! I placed the \ns in side quotes as follows, but the code still is not executing. I'll show you what I've changed:
Hello, everyone. I'm working on a JavaScript confirm box for a contact form I have constructed, but it is most definitely not working. (Everything else but the confirm form works, by the way.) I think I need a (a few) fresh pair(s) of eyes to take a look at what I've got so far. I've tried moving var r to the top with everything else, and I've tried keeping it with in its own if statement, but to no avail. I'm sure it's something silly, but I can't seem to put my finger on it. Any assistance is greatly appreciated. Thanks in advance!

Yeah, I don't think timeClockDAO.readTimePunches(); is doing anything, but I'm not sure I know how to assign it to something.

In terms of printing the values beforehand, I am not sure what you mean. I know that the employeeID that the user types in is correct, because my code won't allow the user to input a non-existant ID, and I know that this ID is recording properly because it shows in the text file. It is the same with the user's choice of I or O. (Maybe I am misunderstanding what you are asking. Sorry!) I'm just confused on how to compare columns[0] in the timeclock.txt file to the user's choice of either I or O, and how to compare columns[2] in the text file to the user's inputted employeeID in order to see if they have already clocked-in or must do so in order to clock-out.
9 years ago

Joanne Neal wrote:
What are you actually trying to do in that piece of code ?

I'm trying to get the TimeClockApp to ensure that an employee who has clocked in cannot clock in again, & ensure that an employee who hasn't clocked in cannot clock out. Sadly, I am quite lost, and am doing it wrong.
9 years ago
It's not so much an error as it is NetBeans giving me the big red stop sign with the exclamation point telling me that the code line if(t.getPunchInOrOut() && choice.equalsIgnoreCase("i")) has bad operand types for binary operator '&&' because the first type of method here is String, and the other is Boolean. Then it tells me that the line within that if statement (timePunches = t;) has incompatible types: TimeClock cannot be converted to List<TimeClock> and pretty much ignores that whole bit of code. I will post the classes that are relevant to this class as I have sixteen different classes in the entire application.





I apologize for the length. Is it possible to use List<TimeClock> readTimePunches() to achieve what I need as the columns are already split there?
9 years ago
No progress. Can anyone help? I'm getting pretty desperate. I know that I have to compare columns[0] and columns[2] from my timeclock.txt file to the user's input to see if someone has punched in yet, or if they have punched out, but I don't know how to do that. Any help is greatly appreciated. While playing with my current code, I did the following:

I am still getting the same errors as mentioned to Ulf. I am completely stumped.
9 years ago

Jacob Draper wrote:If you want to read and write to a text file, I think a stream would be what you're looking for right?

http://docs.oracle.com/javase/tutorial/essential/io/charstreams.html

Hi, Jacob. Thanks for the link. I'm taking a look at the tutorial that it leads to now, though I'm not sure if it's exactly what I'm looking for. (Though it might be!) Currently, I'm not really looking to write anything to a text file, except for after an employee clocks in or out, which is working so far. I want to be able to read what is in my timeclock.txt file to see if someone with a specific ID number has already punched in or not. If they have, I want them to be able to punch out and not punch in again. If they have not, I want them to have to be directed back to the top of the while loop. It's making me just a little bit crazy.
9 years ago

Ulf Dittmer wrote:What does this code do now, and how is that different from what you expected it to do? To put it another way: do you have a concrete question about it?

Hi, Ulf. As of now, it does nothing. I have an error that displays bad operand types for binary operator '&&' on line 84, and another error on line 86 that says incompatible types: TimeClock cannot be converted to List<TimeClock>. It might help to see the other file from which I'm pulling some of these methods. It is as follows:
9 years ago
Hey there. I'm trying to figure out how to read my text file so that an employee with a specified employee ID number must have a record of having punched-in before they can punch-out of the system. Here is what I'm working with so far:

Any help is greatly appreciated. Thank you in advance!
9 years ago

Jacob Draper wrote:You can add


or you could do


Add one of those where necessary. (I believe it would go outside of your for loop. Probably after it?


So it would look like



not 100% that is the location for it, but you are gonna need to put it in the right place to move you to the next line.


Ooh, that's what I was doing wrong. I was putting out.println(); inside the for loop, so I wasn't getting the correct result.

Thank you! I placed out.println(); outside the for loop, and now things are recording correctly. Thanks again, Jacob!
9 years ago

Jacob Draper wrote:Out.println will output and move to next line,
out.print will keep you on the same line.

Remove "ln"

Thank you, Jacob! That almost works completely. Everything is now in one line, but it seems that the second time I go through the TimeClockApp, the next record is recorded next to the previous record (on the same line) instead of on the next line. Like this:

Any tips for recording each line on its own line like this?:

Thanks again!
9 years ago
Hi, guys. I'm trying to print the information entered into my TimeClockApp to a text file named timeclock.txt. Everything is writing to the text file, except instead of adding each part of the run through the app to one line, it is saving each part on a separate line like this:

To ensure that each run through the time clock is recorded on a different line in the text file, I want it to add each item like this instead:

I have tried to execute the out.println(timeClock.get(i)); line as out.println(timeClock.get(i) + "\t"); and out.println(timeClock.get(i) + "\n");, but have had no luck in fixing this problem. My current code that writes the information to the text file is as follows:

Thanks in advance for your help. I'm not very good at Java yet!
9 years ago
Still no progress. If anyone else can help, I would be very grateful. Apparently, I have to set the read-in value of what the user inputs at line 51 to employee ID, but I have no idea how to do that. Can anyone help?
9 years ago