Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 19th, 2005, 7:38 AM   #21
gj15987
Programmer
 
Join Date: Feb 2005
Posts: 45
Rep Power: 0 gj15987 is on a distinguished road
Ok, figured this debugger out, seems its looping around the outer loop. I can't see why...

Quote:
Good to hear it man. I did too. Man, I was crapping myself yesterday morning...
:eek: are you some sort of child prodigy?!?!?
gj15987 is offline   Reply With Quote
Old Aug 19th, 2005, 7:52 AM   #22
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Just another peek at your tables... You have one instance of a break. In the USA, at least in MS, most employers are required to provide 2 15 min breaks during the day.

So the table would need to be modified if it were to be used by my employer..

A typical shift would be...
IN -> BRK_OUT -> BRK_IN -> LUNCH_OUT -> LUNCH_IN -> BRK_OUT -> BRK_IN -> OUT

But if you had no intentions of having a second break, ever, the table you have is fine. Just be sure to incorporate flexibility.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Aug 19th, 2005, 7:54 AM   #23
gj15987
Programmer
 
Join Date: Feb 2005
Posts: 45
Rep Power: 0 gj15987 is on a distinguished road
Quote:
Originally Posted by Infinite Recursion
Just another peek at your tables... You have one instance of a break. In the USA, at least in MS, most employers are required to provide 2 15 min breaks during the day.

So the table would need to be modified if it were to be used by my employer..

A typical shift would be...
IN -> BRK_OUT -> BRK_IN -> LUNCH_OUT -> LUNCH_IN -> BRK_OUT -> BRK_IN -> OUT

But if you had no intentions of having a second break, ever, the table you have is fine. Just be sure to incorporate flexibility.
Sokay, if you read on i've redesigned it so its not done in specific shifts but you can clock in and clock out as many times as you like. Its just this damn loop i need to get around.
gj15987 is offline   Reply With Quote
Old Aug 19th, 2005, 7:59 AM   #24
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Same deal. Not all paths go through a MoveNext, nor does Execute necessarily get set. Write your approach down in English pseudo-code and manually trace through with every possible set of conditions. In your case, that's not a lot. Use that method with more complicated situations at least at certain defined extremes. Part of design, before you ever code, is to define how you're going to apply test conditions in order to verify that the program works as you intend. Your amorphous ideas do not propagate into the code by osmosis. As far as debugging is concerned, you can always sprinkle output statements liberally throughout the code and observe if records are changing, what ID values are, stuff like that.

When things get hot and heavy and frustrating and seem like mysteries of the universe, unfathomable, just walk out to the barn, sit on the top rail of the corral, and ponder why cowshit looks like a frisbee and horseshit looks like a tennis ball. Some things are more mysterious than programming.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Aug 19th, 2005, 8:01 AM   #25
gj15987
Programmer
 
Join Date: Feb 2005
Posts: 45
Rep Power: 0 gj15987 is on a distinguished road
Quote:
Originally Posted by DaWei
When things get hot and heavy and frustrating and seem like mysteries of the universe, unfathomable, just walk out to the barn, sit on the top rail of the corral, and ponder why cowshit looks like a frisbee and horseshit looks like a tennis ball. Some things are more mysterious than programming.
HAHA! yeah ok i'll do the whole write down pseudo code thingy...and I'll let you know if I figure it out.
gj15987 is offline   Reply With Quote
Old Aug 19th, 2005, 8:26 AM   #26
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Sorry, I missed that you redesigned the table.

DaWei, you can tell programmers are truely detail oriented... especially when their eyes have glazed over from eyeballing animal shit all day and pondering the reason for the differences in structure. Now that I think about it, rabbits shit marbles... lol.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Aug 19th, 2005, 8:29 AM   #27
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
One thing they can't say about me, IR, is that I don't know shit. Deer shit grape clusters.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Aug 19th, 2005, 9:22 AM   #28
gj15987
Programmer
 
Join Date: Feb 2005
Posts: 45
Rep Power: 0 gj15987 is on a distinguished road
Snakes shit other snakes...seriously...mine shits these little white balls but every month or so it shits this huge long crap!

Onto the topic though, lol...I'm pulling my hair out now! I've thought of every possibility. Ok, I enter an invalid ID and it goes straight to the else and says that the input is invalid.

For my test data I already have a shift for a particular user, their ID, Time in and date is in the record, the time out field is blank. So i've traced the code through with this user in mind and i cannot see whats going wrong. My code as it stands is:

procedure Tfrm_clock_In.btn_enterClick(Sender: TObject);
var
          Today:TDateTime;
          Executed:boolean;
begin
Executed:= false;
Today:= Date;
tbl_employees.Open;
tbl_employees.First;
Repeat
        if strtoint(Edit_Employee_ID.text) = tbl_employeesEmployee_ID.value then
           begin
                tbl_shift.Open;
                tbl_shift.First;
                repeat
                        if (strtoint(Edit_Employee_ID.text) = tbl_shiftEmployee_ID.value) and (tbl_shiftDate_.Value = Today) then
                           begin
                                if Datetostr(tbl_shiftTime_Out.value)='' then
                                        begin
                                                //sql to updae file with clock out time
                                                showmessage('Clocked Out');
                                                Executed:=true;
                                        end
                                else Tbl_shift.Next;
                           end
                        else tbl_shift.Next;
                Until (Executed=true) or (tbl_shift.Eof); //until record update or no shift found
           end
        else tbl_employees.Next;
Until (Executed=true) or (tbl_employees.Eof);

if tbl_employees.Eof then showmessage('Invalid User ID'); //if don't find a matching employee number then invalid

If tbl_shift.Eof then //if don't find a record to update then create new one
        begin
                //sql to create a new record
        end;
        
end;

Any ideas?
gj15987 is offline   Reply With Quote
Old Aug 19th, 2005, 9:39 AM   #29
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
Quote:
Originally Posted by DaWei
rabbits shit marbles... ..
deer shit grape clusters...
Birds shit on people's heads. (yes... personal experience!)
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Old Aug 19th, 2005, 10:40 AM   #30
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Stop and think about what you're doing, and stop and think about providing useful information in your posts.
Quote:
Ok, I enter an invalid ID and it goes straight to the else and says that the input is invalid.
Sounds like proper operation to me....
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:48 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC