|
A binary search only works if a file is sorted. Then you can check the record in the middle, see if it's higher or lower than the result you wanted. If it's higher, check half way through the upper half, otherwise check the lower half. You keep dividing the number of records you are searching in two, making it a lot faster than iterating through them all. But it won't work unless the records are sorted.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hey thanks 4 ur reply i see what u mean and the records are sortedby the index number for example
0 xxxxx
1 xxxxx
2 xxxxx
3 xxxxx
4 xxxxx
5 xxxxx
6 xxxxx
7 xxxxx
8 xxxxx
Well the thing is i know what binary search is but i dont know how to apply in vb.net and on a file so if u can help ill appreciate it thanks a lot.If u can give me an example or a code thank u.
sam
|
|
|
|
|
Dude, it's really very simple. You have an arraylist, and you search by creating an index to start ( length/2 ), then you keep splitting the index up or down in order to bring down the range you're searching. It's a simple enough problem that I can't give you example code without doing your homework for you. How about you give it a go, and post your code ? If you've tried to do your own homework, and you get stuck, I'll be glad to help.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
A very good resource for this type of algorithm is The Bible ... "The Art of Computer Programming", Volume 3 - Sorting and Searching, by Donald Knuth.
...Steve
|
|
|
|
|
I see what you mean man and i i understand i know i should do my homework i always do
but the thing im new to vb.net and this is for university project about indexing and im late th deadline tomorrow i know your right
thanks anyways
really thanks;P
sam
|
|
|
|
|
man ur my last chance do u have any code for binary search on a file
thanks
sam
|
|
|
|
|
The new Visual Basic Express looks like it would be cool to try out. Will it mess up any of my Visual Studio .net 2003 projects, and asp .net 1.1 sites? Thanks
|
|
|
|
|
I would HIGHLY suggest making copies of them BEFORE you attempt to open them in Express. Opening your current projects in the new 2005 editions of VS.NET will upgrade the projects to the VS.NET 2005 Project formats, making them unusable in VS.NET 2003 and below.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I was only going to open my old projects with Visual Studio .NET 2003. If I didn't open them in the new version, will they still get messed up? I'll make a backup just in case though.
|
|
|
|
|
Nope. So long as you don't do anything with them in 2005, there's no problem.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to get convert rtf to plain and then plain back to rtf if the data in the text box has changed...
thanks,
tom
|
|
|
|
|
Hi im using crystal repor to print students info
but i need like to filter the student id from xxxxxx to xxxxxxx(2 text boxes)
to print if someone can help me that would be great thanks in advance ....;P
sam
|
|
|
|
|
|
Please submit your answer. That will help others.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Hi, please submit your artical on Code Project. I really need this and as many more member may be require this thing.
Waiting for your positive response
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
Ok sure well the thing is i got my answer from a sample i found its very nice it filters the reports by a number or two numbers
Dim a As New Form2
Dim Fltr
Fltr = "{StudentInfo.StudentID}>=" & Trim(txt1.Text) & " and {StudentInfo.StudentID}<= " & Trim(txt2.Text) & ""
a.CrystalReportViewer1.SelectionFormula = (Fltr)
a.Show()
do u know how i can attach my project i dont know the link
sam
|
|
|
|
|
It is nice that you upload your code on Code Project.
There are two way:
First is upload your code on Code Project. Follow this link on the main page of Code Project: http://www.codeproject.com/info/submit.asp[^] and just follow the guildline. You can easilly upload your code. When you successfully upload your code then send me your artical url.
Second is send me your code through email and then i upload it on for you. [ you name must mention on the artical and author]
Anyways, Thanx and please do it.
|Muhamad Waqas Butt|: )
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
Hi there well my situation is that i have two textboxes and i need to write the text in them to a file but whenever i try to write the first time it works but the second time it writes over the old text i need to know how to write the other data into new lines
if u have an exapmle or a sample that would be great thanx....
sam
|
|
|
|
|
MSDN is your friend. FileStream[^] class, with examples of Appending text.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm interested in a file-watching VB program. I've downloaded several programs that use FileSystemWatcher. While this is a very handy utility for checking changes to a directory, I would like an event to be raised when a particular file is used(opened or accessed). The file may used be several times during a day.
I'm experimenting with certain File properties like GetLastAccessTime and SetLastAccessTime. A boolean property would be much simpler.
Any ideas as to how to go about this?
Cam
|
|
|
|
|
What you want can't be done with the FileSystemWatcher. The only way you'll be able to see other processes open files is if you write a kernel mode driver extension to NTFS. This is FAR from trivial, requiring a 5th degree black belt in NTFS internals and driver development.
For a hint of what's involved, search for FileMon at www.sysinternals.com.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi All,
I have a VB.Net (not that it matters), managed application component (COM+, Serviced Component) where I need to be able to do some fairly simple initialise/deinitialise stuff at the process startup and shutdown, so it is available for all object instances thereafter and cleaned up after shutdown. My component is managed, and the startup/shutdown subs would be calling some unmanaged functions, but they're extremely simple - they're only method calls to an independent server running on the same machine.
Is there a really simple way of doing this using the normal methods immediately available to me, like through activate/deactivate?
Note, I would really rather not have to do this through the IProcessInitializer interface unless I really have to. I've had IProcessInitializer implemented, but never got to a position where it worked, as well as it being more effort to configure which is disproportionate to the simple thing I want to do.
Thanks a lot in advance,
David
-- modified at 11:54 Wednesday 21st September, 2005
|
|
|
|
|
Hellow Every one,
Please tell me how to create mutltilines Crystal Report in Visual Studio .Net 2003 Crystal Report Desinger Panel.
Like this:
Column 1 Column2
________________________________
Dummy ID1 Dummy Data Line 1
Line2 of Column2
Dummy ID2 Dummy Data Line 1
Line2 of Column2
___________________________________
Please help Me. If you not getting my point, inform me.
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
i want to download a free library for ftp over SSL and i search a lot but found none.if is this type of library can be downloaded from a site then
please tell me the url.
|
|
|
|
|
I'm wondering if anyone has seen a control for .NET either C#, VB.Net that is the equivilent of the Listview that instead of providing rows in the Downward direction, provides the concept of a Row Horizontally.
I need to provide a list of things for the user to edit, but I want to provide it across the screen.
If i'm just using the listview incorrectly I'd also like to hear about that.
If anyone has any suggestions I would greatly appreciate it.
Thanks
|
|
|
|