Page 1 of 1 1
Topic Options
#200814 - 2010-11-27 08:27 PM INI Structure
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Hello all. I was wondering if I could get your guys wise opinions on a small project I'm starting to work on. I writing a simple time clock type app using kix/kixforms for the office I work at. Nothing extravagant. But I'm having a difficult time determining the easiest way to store the times, so that they are easily queried later to print weekly time sheets etc. Figured a central INI file would be the best, but any opinion on the structure I should take? Trying to pin down best option, before going too far, so I wont have to change my mind later.

Something like?...
 Code:
[User]
clockedin=y/n (use this to make sure a user doesnt try to clock in if theyre already clocked in)
Date:Time=In
Date:Time=Out

I will probably also have a separate settings file as well, with a list of users, and pass codes and what not.

Top
#200815 - 2010-11-27 09:46 PM Re: INI Structure [Re: ShaneEP]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well... you got the Date:Time keys the wrong way around. They need to be unique.

In=Date-Time
Out=Date-Time
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#200816 - 2010-11-27 09:51 PM Re: INI Structure [Re: Les]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You might consider giving each user their own UserID.INI file to avoid contention. To prevent one user from tampering with another user's INI file, you could ALC it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#200817 - 2010-11-27 10:01 PM Re: INI Structure [Re: Les]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
With the format that you used wouldnt it overwrite the entry if they clocked in/out more than once in a day since there can only be 1 IN key and 1 OUT key?
Top
#200818 - 2010-11-27 10:52 PM Re: INI Structure [Re: ShaneEP]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OK, I misunderstood thinking "Date:Time" was the literal key name. So you want the keys to be the actual date/time and you want to the number of keys to grow. Remember that the larger the INI file the longer it will take to process and so the greater the possibility of contention. If you give each user their own INI that should not be a problem.

I was assuming you had a back-end that collected the data from the INI into a db. The longer the data sits in that INI file, the greater the loss if the user tampers with it/them.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#200819 - 2010-11-27 11:34 PM Re: INI Structure [Re: Les]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Yea its not even that complex. There are about 8 total employees here, and they are currently using some trial version of a time clock program that somebody found on the internet at some point. It simply saves an in/out to a .txt file, and only allows 3 people to use it per computer. Everyone just prints out a weekly report of their hours and turns it in to the boss at the end of the week. So just about anything will be an improvement. But I think you're right, I will probably create a separate INI for each user, and then maybe rename the file every time it becomes x days old or every month just to have some kind of backup. Employees being able to clock in/out, or printing their time sheet, from any terminal will be helpful.
Top
#200820 - 2010-11-28 12:22 AM Re: INI Structure [Re: ShaneEP]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Instead of renaming, maybe you could name it initially with @UserID+$WeekNumber where the number is between 1 & 52.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 271 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.054 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org