I need to optimize my code.

Get help on programming - C++, Java, Delphi, etc.
doo_much
Registered User
Posts: 26022
Joined: 13 May 2004, 02:00
Location: Getting there...
Contact:

Re: I need to optimize my code.

Post by doo_much »

SBSP wrote:Hey people.etc etc

Every thing works fine, But it only shows the users in the log , so if a user did not log in it means that his or her log wont show late or on time.

So I wrote the below to match the logged users and map it to a textfile that has all the users
per line in a normal .txt file that also resides on a network drive next to the database.

Okay so this might be a daft question BUT :lol:

Why not create a user table in Access to start off with? Why a text file?
MOOD - Thirsty

A surprising amount of modern pseudoscience is coming out of the environmental sector. Perhaps it should not be so surprising given that environmentalism is political rather than scientific.
Timothy Casey
SBSP
Registered User
Posts: 3124
Joined: 09 May 2006, 02:00
Location: Centurion

Re: I need to optimize my code.

Post by SBSP »

doo_much wrote:
SBSP wrote:Hey people.etc etc

Every thing works fine, But it only shows the users in the log , so if a user did not log in it means that his or her log wont show late or on time.

So I wrote the below to match the logged users and map it to a textfile that has all the users
per line in a normal .txt file that also resides on a network drive next to the database.

Okay so this might be a daft question BUT :lol:

Why not create a user table in Access to start off with? Why a text file?
I wanted to bot i'm scared its going to have an effect on the Databse it self
The database comes with the application and the whole system costed us like 60 000 bucks so i dont want to go and mess with it.

I also don't want to make any mjor changes" I should have done that right from the beginning"

Like i said it works a bit slow i can live with it and also i use the above code to run it on other things aswell genirated out of crystal reports so if i can get this working it will make life easy!
doo_much
Registered User
Posts: 26022
Joined: 13 May 2004, 02:00
Location: Getting there...
Contact:

Re: I need to optimize my code.

Post by doo_much »

SBSP wrote: genirated out of crystal reports
Screeechhhh!!

Wait - stop - do you use Crystal Reports or do you just get given output of Crystal Reports generated from this system?
MOOD - Thirsty

A surprising amount of modern pseudoscience is coming out of the environmental sector. Perhaps it should not be so surprising given that environmentalism is political rather than scientific.
Timothy Casey
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Post by RuadRauFlessa »

It goes like this see. If you are afraid to make a major change then don't cuz then you will only muck it up. Keep the text file and just scan the last entry in each users log to see what it is. Will take more processing but if you are afraid of digging around and adding a table to a db then leave it as is and work around the problem. although working around a problem is never really smart cuz it will always come back to bite you in the behind.
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
JavaMan
Registered User
Posts: 4
Joined: 02 Aug 2005, 02:00

Re: I need to optimize my code.

Post by JavaMan »

doo_much wrote:
SBSP wrote:Hey people.etc etc

Every thing works fine, But it only shows the users in the log , so if a user did not log in it means that his or her log wont show late or on time.

So I wrote the below to match the logged users and map it to a textfile that has all the users
per line in a normal .txt file that also resides on a network drive next to the database.

Okay so this might be a daft question BUT :lol:

Why not create a user table in Access to start off with? Why a text file?

Although this probably wont help you, if you had 2 tables in the db, then you could have just run a query like this e.g.

SELECT a.userUID, a.sFirstName, a.sLastName, b.loginTime
FROM tUsers a
LEFT OUTER JOIN tLoginTimes b
ON b.userUID = a.userUUID
WHERE b.loginTime > '2007-01-10 08:00:00'

This example assumes that you have 2 tables, 1 for users and 1 for login times. (Very basic thought, could be a lot more useful)
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Post by rustypup »

JavaMan wrote:You can probably do the entire job by simply using one query.
hence my question around the normalisation...

this smacks of a jury-rigged cover to overcome a bad design... almost always the worst possible approach, (i've known one or two instances were it was probably acceptable...)..

<ot>
and a warm welcome to JavaMan! :D
</ot>
RuadRauFlessa wrote:although working around a problem is never really smart cuz it will always come back to bite you in the behind.
:thumbsup:
Most people would sooner die than think; in fact, they do so - Bertrand Russel
SBSP
Registered User
Posts: 3124
Joined: 09 May 2006, 02:00
Location: Centurion

Re: I need to optimize my code.

Post by SBSP »

doo_much wrote:
SBSP wrote: genirated out of crystal reports
Screeechhhh!!

Wait - stop - do you use Crystal Reports or do you just get given output of Crystal Reports generated from this system?
For this system no, i use a querry using the MS querry in excel to get the data but over all
i use crystal reports

But i would like to optimize the code as the topic sais

Oh and i dont care how bad it is and how i approached it,.
Last edited by SBSP on 10 Jan 2007, 15:24, edited 1 time in total.
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Post by RuadRauFlessa »

Hehehe that is why I like you rustypup you have common sence :thumbsup:
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
SBSP
Registered User
Posts: 3124
Joined: 09 May 2006, 02:00
Location: Centurion

Post by SBSP »

Never mind!!!!

I will somehow get what i wana do.
Hex_Rated wrote:
Can any one remember how you calculate the left over amount.
when dividing.
Use modulus. 21 mod 2 = 1
Thanks for that

RuadRauFlessa please delete this thread its going no where
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Post by RuadRauFlessa »

SBSP wrote: RuadRauFlessa please delete this thread its going no where
By request it will be blocked rather than deleted in any case.
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
Locked