|
hi christian
my program is a file searching utility
i have made a class SEARCHER which goes to all directories and gets the
files that match the search string.
i wanted to index all files present in HDD
so i made an array of SEARCHER with size = all drives and call it using *.* as search string. all members are called in a separate thread so as to do all
drives at once
i have added a list box which displays the found files.
then i iterate through all items of listbox writing them one by one
I have dropped the static arrays
but the prob persists. if total items are 25000
then only top 15000 or 10000 are being written
Christian Graus wrote: you have threads writing files as the data is being filled
no when the list box is filled then only the writing starts
Christian Graus wrote: do they write to the same HDD ?
yes they write to the same HDD
Christian Graus wrote: Why do you have 5 threads all writing at once ?
to write more in less time.The no of threads depend on the number of drives that are ready.
i also tried running a single thread.
in it also, only some files of top are being written.
TheMrProgrammer
|
|
|
|
|
Hi,
you failed to clearly tell us what you are doing. Writing data, any data, to different files, using one thread per file, can be done correctly, which does not mean it always makes sense. If you want detailed help, show us some code (in PRE tags!) for two of those threads and files.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
hi Luc
please read my reply to Christian
TheMrProgrammer
|
|
|
|
|
Hi,
you didn't show any code, at least you explained a bit.
"so i made an array of SEARCHER with size = all drives and call it using *.* as search string" is ambiguous; at best you have a double risk:
1. the number of files returned by GetFiles/GetDirectories could be huge, you may run out of memory
2. you may encounter "access denied" problems on special folders such as "System Volume Information".
Both of these would show up if you were using try-catrch blocks showing all available exception information, i.e. using Exception.ToString(); qnd everything would vanish silently if you are just swallowing exceptions.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
thamks for your suggestions Luc
but my problem is that out of 25000 files in the
list box only top 15000 or 10000 are being written
i tried putting the contents of the list box in a string variable
but without success
For x = 0 to listbox1.Items.Count-1
strVar &= listbox1.Items(x).ToString
Next
my.comp.filesystem.writealltext(filepath,strVar)
but instead "#ERROR 488# is written
TheMrProgrammer
|
|
|
|
|
TheMrProgrammer wrote: For x = 0 to listbox1.Items.Count-1
strVar &= listbox1.Items(x).ToString
Next
for counts of many tenthousands, this is non-seense: the final result would probably be a string with a length exceeding one million characters, however building it also creates tenthousands of intermediate strings of growing length, so your code is bound to be extremely slow, and may well run out of memory.
furthermore, there was no need whatsoever to concatenate everything, since File class also has a WriteAllLines() method, which takes an array of strings.
finally, if you do not absolutely need to hold lots of data in memory, then don't. Just write the text lines as you get them. I know you are failing here so far, due to reasons unknown to all of us as you still haven't shown us real code. Lacking that, I will not continue this thread.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Hi everybody
I must declare some constants on VB.NET based on some C code that I have, like this.
#define ABCDE_FGH 0x00008603L
How could I do this on VB.NET? I get an error doing this:
Public const ABCDE_FGH = 0x00008603L
Public const ABCDE_FGH 0x00008603L
And I'm afraid to use this:
Public const ABCDE_FGH = "0x00008603L", because although I don't get an error, it would be only text...
Does somebody know something about this?
Thanks everybody
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
garfield185 wrote: Public const ABCDE_FGH = 0x00008603L
Did you read the error ? What does it say ?
You don't have a type, just access modifiers. Try public const int, and if that doesn't work ( I dunno if VB supports 0x for hex ), try converting it to a decimal number in calculator and put that.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
hi
visual basic does not support ox00008603L
try with:
Public Const ABCDE_FGH As Integer = &H00008603L
or
Public Const ABCDE_FGH As Long = &H00008603L
|
|
|
|
|
Perfect.
Thanks both of you!
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
i m making a project over bank management on vb.net but can't figure out where to start from
|
|
|
|
|
Click on file, then choose new, then choose project. From there, read the details of your homework, talk to your teacher if you are lost, and ask us if you have a specific question.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Yeah, it usually starts with an interview process to gather the system requirements. It kind of helps to know what the application is expected to do, don't you think?
|
|
|
|
|
Sacrifice a virgin and drink goat blood? Seem absurd? So is this question.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
What do we do if he responds, "All set, what next"?
|
|
|
|
|
I guess we're going to the market to buy a goat and goblet to drink with.
A willing virgin might be hard to find these days.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
<body bgcolor="#000000" topmargin="7"><font color="#ff0000"> <table cellspacing="1" cellpadding="1" width="200" border="1">
<tbody>
<tr>
<td>WHY?</td>
</tr>
</tbody>
</table> </font> </body>
If you saved those codes as a html file,the "why?" showed as red.If you used DHTMLEdit control to compile those codes,the "why?" showed as black.Why?
help
|
|
|
|
|
I cheched the above code in IE6 and Firefox 3.5(Beta), output for the html file was black
|
|
|
|
|
That is right.The background is black,But the text in the table shows different.In html file it shows as red.If you use DHTMLEdit control to compile those codes,it shows as black.Is it a bug?
help
|
|
|
|
|
How Can I Open my Created File Format With My Created Program .
As: Open anything myfile format in Program at runtime.
but when closed my program and click on my file with my format file open my program but not reading my file.
For example:
my new file format is: *.dmd [OK]
Should be Open by My Createt Program. [OK]
For Example: *.txt Open By Notepad or *.bmp open by image and faxviewer
Please Reply egain.
modified on Wednesday, June 24, 2009 10:15 AM
|
|
|
|
|
It's to do with file associations on the client computer - ie: open Windows Explorer, right click the file you want and click Open With... select your application, tick the box that says "Always open with this program".
|
|
|
|
|
Hi,
there are two parts to this:
1. the file association: teaching Windows your file extension goes with your app; the easiest way to achieve that is by doing it manually once, i.e. double-click a file, choose the right app and check "always open using this app". A more complex way is adding some code.
2. the opening of the file: your app will now be launched with one (or more) file paths as command line arguments, so your app must read the command line and act upon it. See Environment.GetCommandLineArgs()
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Sorry, I'm sure this is obvious... When I start my program from a shortcut in Vista the default directory becomes c:\windows\system32. How do I make the default directory the path that the .exe is actually in?
Thanks
|
|
|
|
|
In XP, you can set the "Start In" directory in the shortcut itself. Can you not do this with a Vista shortcut?
Of course, there are VB functions to get the App Directory from within code if this is what you are after...
|
|
|
|
|
I don't see any way to change the "start in" value in Vista. In any case there must be a way to change the default directory programmatically.
|
|
|
|