D
David
Hi all,
I am new to Hashtables, so at the moment, not fully familiar with them.
I have been experimenting with a search engine spider written in c#. It uses
hashtables to hold the catalog.
Now, if I have a large site, or I want to scan many websites, then the
hashtables would get very large. I am looking at writing them to disk and
reading them, though am not sure how this would work.
Now, I have found this on the net (vb code, I can convert, so no need to
worry about that)
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSave.Click
'Save the hashtable
If File.Exists(Application.StartupPath & "\data.dat") = True Then
File.Delete(Application.StartupPath & "\data.dat")
Dim fs As New FileStream(Application.StartupPath & "\data.dat",
FileMode.CreateNew)
Dim bf As New
Runtime.Serialization.Formatters.Binary.BinaryFormatter()
bf.Serialize(fs, HashTest)
fs.Close()
End Sub
Private Sub cmdLoad_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdLoad.Click
If File.Exists(Application.StartupPath & "\data.dat") = False Then
Exit Sub
Dim fs As New FileStream(Application.StartupPath & "\data.dat",
FileMode.Open)
Dim bf As New
Runtime.Serialization.Formatters.Binary.BinaryFormatter()
HashTest = bf.Deserialize(fs)
fs.Close()
cmdIterate_Click(Nothing, Nothing)
End Sub
which looks like it might be suitable... but, my question is then,
1. Can I incrementally add to the hashtable file so that I don't run out of
memory when scanning for files to catalog
2. When reading it back off disk, do I have to read the whole lot into
memory in order to search through it?
If I can't do either of these, then what would you suggest?
The way I want to use it is somewhat like a sql database, where I can
quickly select the records I need.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
I am new to Hashtables, so at the moment, not fully familiar with them.
I have been experimenting with a search engine spider written in c#. It uses
hashtables to hold the catalog.
Now, if I have a large site, or I want to scan many websites, then the
hashtables would get very large. I am looking at writing them to disk and
reading them, though am not sure how this would work.
Now, I have found this on the net (vb code, I can convert, so no need to
worry about that)
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSave.Click
'Save the hashtable
If File.Exists(Application.StartupPath & "\data.dat") = True Then
File.Delete(Application.StartupPath & "\data.dat")
Dim fs As New FileStream(Application.StartupPath & "\data.dat",
FileMode.CreateNew)
Dim bf As New
Runtime.Serialization.Formatters.Binary.BinaryFormatter()
bf.Serialize(fs, HashTest)
fs.Close()
End Sub
Private Sub cmdLoad_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdLoad.Click
If File.Exists(Application.StartupPath & "\data.dat") = False Then
Exit Sub
Dim fs As New FileStream(Application.StartupPath & "\data.dat",
FileMode.Open)
Dim bf As New
Runtime.Serialization.Formatters.Binary.BinaryFormatter()
HashTest = bf.Deserialize(fs)
fs.Close()
cmdIterate_Click(Nothing, Nothing)
End Sub
which looks like it might be suitable... but, my question is then,
1. Can I incrementally add to the hashtable file so that I don't run out of
memory when scanning for files to catalog
2. When reading it back off disk, do I have to read the whole lot into
memory in order to search through it?
If I can't do either of these, then what would you suggest?
The way I want to use it is somewhat like a sql database, where I can
quickly select the records I need.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available