Solved

How to make to create year estimate off research

Posted on 2006-11-15
7
143 Views
Last Modified: 2010-04-05
I cuts the quantity off files to seek and it is necessary for the temp to me estimated that its take to curry it out.
0
Comment
Question by:ProgsX
  • 3
7 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 17948732
first: you should probably use an online translator such as babelfish: it might get more comprehensible information. If there is no online translator for your language, then you should be more specific and as possible provide examples.

now, what I understood is that you want to do some processing (delete maybe?) and you want to know how much time it will take. When dealing with files and want to build a progress you need to know eitehr the total number of files or the total size of all files or something like that, in any case it implies that you loop through all files. this takes time. Now, some operations take aproximatly the same time as the looping itself. such an operation is delete.
so as a general rule, if an operaition takes as much time as the looping itself, there is no sense in doing the looping.
UNLESS, you can beat the looping by using some "tricks"/functions provided by the filesystem.

with NTFS you might be using the indexing service and maybe some other mambo jambo I never heard of (and russel for example might probably tell us sooner or later about such stuff) that will drastically reduce the time to do such a looping (finding out the number of the files for instance).

anyway, before getting too much into the matter: what exactly are you trying to do?
0
 
LVL 28

Expert Comment

by:2266180
ID: 18832856
may I know the reason for a C grade?
0
 

Author Comment

by:ProgsX
ID: 18843150
ok I read my question and yes it is true it is not clear for me.  excuse me.

My question was, how to create a function to estimate a research.

ex :  in my documents, the estimation time for find all files.
0
 
LVL 28

Accepted Solution

by:
2266180 earned 125 total points
ID: 18843350
that will be in most cases impossible to do. I'll explain why:

- in order to estimate a processing (in your case finding all files) you need to know at least aproximatly (best would be to know exactly) how many files are there and how much time it takes to find one file. then you can multiply the 2 and you're done.
- unfortunatly, there is no way of knowing in advance how many files there are in a directory (at least not in fat/ntfs file systems, on which windows is running). if you don't believe me, go in windows explorer, right click the windows directory (or program files directory, in any case, something big) and click properties. you will see that the "size", "size on disk" and "contains" fields are constantly being updated until finish. if windows cannot do it, we can't either. this is because windows uses the only possible way of determining the total number of files and their attributes in a directory: loop through it.

so in this particular case, if you want to know how much time it will take to find a file in a directory, the short answer is: you cannot.
the longer answer is:
- you can, but it's not worth it. because, you will have to loop through all files in that directory, compute the time, and then, again, loop through all files in the directory and make the search. in the end, you will do the same operation twice, because the time it takes to calculate the total time and to search for a file is aproximatly the same. so let's take a small example: if your search takes 5 minutes, then finding out how much time it would take (presuming you don't know that it takes 5 minutes yet) will take aproximatly 5 minutes, so in the end, you will end up to spend 10 minutes for a 5 minute process: 5 minutes to find out the time and 5 minutes to do the search.

as I explained in my first post, this method is usefull in case you want to do time costly operations.
for example copy the files. or compute an md5/tth/etc hash, or crypt the file. these operations take a long time. in this case, it worths waiting 2 minutes to compute the time to inform the user that the actual process will take 5 hours. you can spare 2 minutes to inform the user of a 5 hour job ;) but it doesn't worth it to spend 2 minutes to inform the user that the operation will take 2 mintues. it also doesn't worth to spend 2 minutes if the operation takes 4 minutes. the difference is still too much.

so in such cases of non-time consuming jobs ( like searching, deleting, renaming files, etc) it is best to just show some kind of progress indicator (like the animations from windows in which a file goes from one end of the bar to the other, or some bar floats around, etc) so that the user will know that the process is going on and the system did not freeze.
another way of informing the user is to use a statusbar and display in it the current file or directory being processed, this way the user has a more realisting progress of the job.

so bottom line: all jobs can be estimated of the time they need to finish; but not all of them worth the effort of doing so.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need Delphi function to get Youtube video title 5 226
Internet Explorer View Settings Question 15 106
How to debug For loops? 3 45
update joined tables 2 31
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now