Page 1 of 1 1
Topic Options
#75777 - 2003-07-09 09:08 AM Reading from INI file at same time
attiahia Offline
Hey THIS is FUN

Registered: 2000-03-27
Posts: 268
In our login script I want to add part where all users (approximately 800) will access INI file at the same time and read specific data from it. Will this cause any problem?

The ini file will be like:
[Jhoanxm]
BadgNum=80922
[Mikalbn]
BadgNum=80514
[Sungyxc]
BadgNum=534291

The script will get the user id when he logged on and then access the ini file on the server and extract his BadgNum after it match his user id with the same one in the ini file.

Thank you.

Top
#75778 - 2003-07-09 09:12 AM Re: Reading from INI file at same time
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, some say that it might cause problems.
all I can think of is little bit delayed read.

but, who has even tested these things? [Confused]
just try it out and see what happens.

btw, you should keep the file rather small as every time you access ini-file, the whole file is read and if you do multiple reads with 800 dudes at the same time, you may exchaust even mainframe servers [Wink]
_________________________
!

download KiXnet

Top
#75779 - 2003-07-09 09:51 AM Re: Reading from INI file at same time
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
It shouldn't be a problem.

If they are all reading the file at the same time it will be cached, so access will be fast.

You are only reading, so there won't be any locking or trespassing issues.

If you were to update (write) the file there may be an issue, but in your situation there should not be.

The only overhead will be traffic, as potentially the entire file will need to be transferred.

If you want to reduce the network traffic, split the INI file and base the file name on the first letter of the users login.

If you want to be more tricky a modulo hash of the login may give a better spread.

Top
#75780 - 2003-07-14 09:36 AM Re: Reading from INI file at same time
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
The only thing you might consider is the size of the ini ... KiX is as well sticky to the limitation which was IIRC 64K (Was this NT ?)

(800 users login at the same time ? Wow, your company has strict policies [Big Grin] )

[ 14. July 2003, 09:37: Message edited by: Jochen ]
_________________________



Top
#75781 - 2003-07-14 10:25 AM Re: Reading from INI file at same time
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah.
if you don't login durin 7:50am-8:01am, you are welcomed to try again tomorrow [Big Grin]
_________________________
!

download KiXnet

Top
#75782 - 2003-07-14 02:01 PM Re: Reading from INI file at same time
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
quote:

The only thing you might consider is the size of the ini ... KiX is as well sticky to the limitation which was IIRC 64K (Was this NT ?)

No and Yes.. No as the 64K limit of the INI files was brought forward with the advent of Windows 95 from the Windows 3.x days. Yes as with Windows 3.x you could only do so much with the setup of the computer. At this point, M$ thought it would be prudent to store these settings in the Registry. The main objective of the INI files in the Windows world, is legacy support.

Kent

[ 14. July 2003, 14:12: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#75783 - 2003-07-14 02:11 PM Re: Reading from INI file at same time
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
And we can be glad that Microsoft still supports legacy things [Big Grin]
_________________________



Top
#75784 - 2003-07-14 05:14 PM Re: Reading from INI file at same time
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I bet that's by mistake [Big Grin]
_________________________
!

download KiXnet

Top
#75785 - 2003-07-15 06:40 AM Re: Reading from INI file at same time
attiahia Offline
Hey THIS is FUN

Registered: 2000-03-27
Posts: 268
This what I am going to do. Your comments will be appreciated.
$String1=” a,b,c,d,e,f,g,h,I,j”
$String2=”k,l,m,n,o,p,q,r,s,t”
$String3=”u,v,w,x,y,z”
Following is example for the INI file where login script read from it to extract the employee badge# and a specific file name to be used latter in coping this file on the employee desktop during the login process.

[BUGAYORC]
BadgNum=534241
FileOpen=Bugayong, Rodolfo 534241
[CHURCHMX]
BadgNum=165340
FileOpen=Churchill, Michael 165340
[DELACRJV]
BadgNum=538147
FileOpen=Dela Cruz, Javier 538147

I will read from the main TXT file which includes all the 800 employee’s data (badge# and file name) and which I use to create the INI.
$q = open (1,"@curdir\Empls_Data.txt")
DO
$Read1=readline(1)
Then the data will be sent to 3 ini files (instead of only one) based on the first character in the user id.
$Userid=Substr($Read1,1,6)
$Read2=Substr("$Userid ",1,1)
IF instr("$string1","$Read2")
$Writ=WriteProfileString("@curdir\Emply_1.ini","$Userid ","BadgNum",$Bagm + all other read data)
ENDIF
IF instr("$string2","$Read2")
$Writ=WriteProfileString("@curdir\Emply_2.ini","$Userid ","BadgNum",$Bagm + all other read data)
ENDIF (of course I can use case here)
And so on
With this way the 800 names will be distributed over 3 ini files instead of 1 file and In the login script user will be connected to one of these 3 files based on his login id first character.
Thank you.

[ 15. July 2003, 06:42: Message edited by: attiahia ]

Top
#75786 - 2003-07-15 11:33 AM Re: Reading from INI file at same time
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
As a simpler and more flexible mechanism, use a modulo hash. You can do it on just the first character if you want:
quote:
$sFileName="Badge_"+(Asc(LCase($sLogin)) mod 3)+".ini"
Using the names from your example gives:
quote:
BUGAYORC=Badge_2.ini
CHURCHMX=Badge_0.ini
DELACRJV=Badge_1.ini

If you want to spread across more files, just change the modulo number from 3 to the number of files you require.

If you don't get a decent spread - perhaps many logins use the same first letter - sum the ASCII values of the login and apply the modulo to that instead.

Top
#75787 - 2003-07-15 03:28 PM Re: Reading from INI file at same time
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why not put the badge number into the "Full Name" filed in the "User Manager for Domains" like
code:
Username = "BUGAYORC"
Full Name = "Bugayong, Rodolfo 534241"

You can then parse the @FULLNAME macro. This will eliminate the use of .INI files and make sure that the info is always up-to-date.
_________________________
There are two types of vessels, submarines and targets.

Top
#75788 - 2003-07-16 05:05 AM Re: Reading from INI file at same time
attiahia Offline
Hey THIS is FUN

Registered: 2000-03-27
Posts: 268
Actually, I am storing & reading much different type of data in\from the ini file. Badge# , full name and file name were just examples of this ini file data. Thanks a lot gentlemen.
Top
#75789 - 2003-07-16 04:27 PM Re: Reading from INI file at same time
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If you need to rerieve even more data, then you should upgrade to a database to store the info in, e.g. SQL Server, MySQL, or even upgrade to AD.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.072 seconds in which 0.032 seconds were spent on a total of 12 queries. Zlib compression enabled.

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