Solved

How to make to create year estimate off research

Posted on 2006-11-15
7
145 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 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