Read Chunks From A File And Store Them In A List?
Dec 2, 2010
I have a list of files and all of them have a different size. I need to upload them in chunks of 250Kb (or less if it's a small file or if it's the last chunk of a file).What I would like to do is read a bunch of chunks (lets say 15 chunks), in a separate thread, and then store the chunks of data in some sort of list. This list must be available to other threads.
An upload thread (I don't need help with uploading itself) takes the first chunk from the list and marks the chunk as "currently being uploaded". When the chunk has been fully uploaded, then the chunk is removed from the list. A second upload thread takes the next available chunk in the list that has not been set to "currently being uploaded", etc. There are a total of 10 upload threads working at the same time.
As soon as a chunk is removed from the list, then a new chunk of data is read and added to the list.Does anybody know what kind of list I need or how I should do something like this? I don't expect people to write out the code for me, but I have no idea where to start with this.
View 4 Replies
ADVERTISEMENT
Dec 24, 2011
I keep trying to encrypt a large file using this method: How to encrypt and decrypt a file by using Visual Basic .NET or Visual Basic 2005
However, these files can be upwards of 400MB. Naturally, I keep getting a system.outofmemory ex. Apparently, I can fix this by processing the file in chunks, but I haven't the slightest idea of how to do this.
View 9 Replies
May 17, 2011
I have a string with xml data.Dim appManifest As String = New System.IO.StreamReader(Application.GetResourceStream(New System.Windows.Resources.StreamResourceInfo(e.Result, Nothing), New Uri("AppManifest.xaml", UriKind.Relative)).Stream).ReadToEnd()
[Code]...
View 2 Replies
Aug 31, 2011
I am coding a file downloader, when I got over this problem. I can not figure out how to download files in chucks.-file-chunks.htmlbut since it's not answered yet, I'm reposting it here kind of.
View 13 Replies
May 24, 2011
I have a data in the below format
number = 4
length = 7
force = 100
Now I want to read it in a format that it will check the string 'number' or 'length' or 'force' or whatever and stores this data into specified arrays or listboxes. Like a force() array or listboxforce.items()
View 2 Replies
May 25, 2010
I have developed a vb.net dll (.net 3.5) which does the following :
- I have data of several stock market companies.
- They are stored in several folders under a main folder.
- These files are random access files.
- There can be around 4000 files in total for example.
I wrote a program which reads a current csv file and stores contents in array. Then I store name and path of companies in folders (which I was talking about). Then I match one company from csv (stored in array) to companies in user's folder (again reading from array). If found I insert data in the file (random access file). This whole process takes for eg. 2 min my system. A similar program was written years ago by someone in powerbasic which takes slight less time if run one but if run for multiple csv files it takes only a few seconds doing the same thing for other files. When I do the same thing (by writing code to .net dll) and making a dummy app to run it, no matter how many times I run it takes same time. And is way slower than the earlier one (PB) one I was talking about. But if I paste the same code in my win (.net) app and not use .net dll then it runs a bit faster.
I need to show status so if I pass my form's label reference to .net dll and it updates it does that slow down process a lot. As I mentioned I am trying to process the files and it takes longer in .net. What should I do to get best performance? Unfortunately due to unexplainable reasons I cannot change the format or use a db. The files which I am reading/writing (random access files) are use by other products so I have to stick to that format. What I am doing is storing the location of those files in array so that I don't have to search folder again. that is not taking time. But opening reading and writing files is time consuming if I am doing it for few thousand of them. A similar program in powerbasic (developed years ago) runs fast. Running code thru .net dll is slower than running it thru program. Why?
View 4 Replies
Jan 30, 2011
I have a large wikipedia dump that I want to cut into different files (1 file for each article). I wrote a VB App to do it for me, but it was quite slow and crapped out after a few hours of cutting. Im currently splitting the file into smaller 50mb chunks using another app but thats taking a long time (20-30 minutes for each chunk). I should be able to cut each of these up individually if I do this.
Does anyone have any suggestions of a way to cut this file up quicker?
View 4 Replies
Jul 21, 2011
I've been trying to create my own backup system by sending specific files to a server running on my desktop, and then having those files copied to an external. So far, I'm trying to send files using a tcp network. Unfortunately, for soem reason, tcp cannot send more than 9kb at a time, so when i tried to send a 30kb image, it recreated 1/3 of it. My fix to this problem was to send data by chunks of 8kb, then reconstruct the file chunk by chunk. For some reason, when I run the server and client, the client says it sends all the data, however the server seems to be stuck. Here is my code;
[Code]...
View 2 Replies
Jun 10, 2011
i am try to read from a file and then split the data and store them in an array but i am getting an error. can someone please point to the right direction here is the file i am trying to read from
8
223432,YNYYYYYYYYYNYNYNYYNY-
623123,YNYNYNYYNY--YNYNYYNY
912234,YYYNYNYNYNYYNYYNYYNY
[code].....
View 3 Replies
Feb 19, 2012
I am unable to read from the text file in VB. I want to read the contents for text file and store them in array. See my code below and the text file. How should I read this text file.
'Purpose : This program will read student name & final marks for a set of students from the text file and then calculate & display class average, class standard deviation, number of students above class average, name of student with highest mark, number of students with A's(90-100), B's (80 < 90), C's (65 < 80), D's (50 - < 65) and F's (<50).Calculate for standard deviation of a set of numbers:Step1. :Find the average Step2. : Square the difference between each number and the average
[Code]...
View 4 Replies
Dec 24, 2010
My text file is a settings file and I know I will be adding more to it in the future, right now it reads "autoplay=false;mintray=false;"I am currently using probably the most inefficient way to check both of those settings:
if contents = "autoplay=false;mintray=false;" then
elseif contents = "autoplay=false;mintray=true;" then
elseif contents = "autoplay=true;mintray=false;" true
elseif contents = "autoplay=true;mintray=true;"
endif
How can I read the file, find each word from the equals sign to the semicolon, and store each of them in a variable identified by the text before the equals sign? Something like this:
contents = "autoplay=false;mintray=false;"
autoplay = "false"
mintray = "false"
Also, how can I edit the settings in the text file without having to overwrite everything every time I save to it? For instance; finding mintray in the text file, and changing mintray to true instead of overwriting the file with "autoplay=false;mintray=true;".
This is my current
Reading
Dim fs As New FileStream("C:myfile.txt", FileMode.Open, FileAccess.Read)
Dim d As New StreamReader(fs)
[code]....
View 3 Replies
Oct 16, 2011
Is there a class or something I can add to be able to read an email?I really want to be able to make a real email client (like outlook).Is it possible with vb.net?
View 1 Replies
Nov 30, 2010
I have a .txt file i want to read that has states by abbreviation and states by name. In that text file some are territories and some are states.
I want to read from that file and put the abbreviations into one structure array and the states into another structure array.
I then want to lookup up the states by abbreviation or state name. The lookup will simply be selected by a radio button which will flag either the states full name array, or the abbreviation array.
all I have is the structures created:
Public Class Form1
Structure Lookup
Dim Abbreviation As String
[Code]....
How can I read from the .txt file and store into an array
View 3 Replies
Jul 1, 2009
I have to text file in the following format :
Word[tab][tab]Word[Carriage Return]
Word[tab][tab]Word[Carriage Return]
Word[tab][tab]Word[Carriage Return]
I want to get all the words before the tab into one array or to create a new text file and the all the words after the tab into another array or create a new text file too.
Here my function to get the words before tab into an array :
Protected Sub MakeWordListBeforeTab()
Dim filename As String = "D:lao�0001.txt"
'read from file'
[Code].....
I wrote the above function to get all words before tab but I got all the words into array. I've been trying to use the Split method above. What is another method to split those words ?
I know this can be done with regular expression but I don't know regex yet. If you can show me how to get this done with regex it'll be awesome.
View 2 Replies
Feb 28, 2010
I am trying to read every file in a list box. and add it to a checked list box.
View 1 Replies
Apr 10, 2012
How would i read a set of names out of a file and then append them to a list box?I am not guaranteed a pair will be on the same line, and not guaranteed that a line would contain a maximum of one pair(i.e., it might have three pairs or it might have one and a half pairs - a first name, last name, and another first name whose matching last name would be on the next line). A line may also be blank.All of this needs to be in a visual basic format.
View 1 Replies
Jun 9, 2011
I'm having some problem here. I have a list of files to read and have to append them all to one unique file. the problem is that when i open the first file to read. I read the first line and discard it. when i read the second line, its empty ! but it is not in the original file. what im doing wrong ?
[Code]...
View 2 Replies
Apr 21, 2010
I got my code to read a txt file and import it to a list view. (that is on the form2)so on my form i I want to grab the value of listview1 line 1 in form2 so I tried
dim input_list as string = frm2.listview1.items(i)
But I get an error then I added .tostring in the end and with luck I got something like listviewritem {Jhon}but I only want jhon. Dont want to add trim or delete?
View 4 Replies
Apr 17, 2012
These are the directions for the assignment.So far I am able to get the file read and printed onto a list box.The book we have for the class does not clearly talk about using the array of structure method with formatting an imported text file.After that I'm pretty much having a bit of trouble with everything else.I know I can figure most of it out but what I'm having a big amount of trouble with is the array of structures that he wants.I know that when I have the file imported that I need to save it temporarily and go through it and at every ":" put it in an array and save that spot and then keep scanning through the file. I know it is going to be a for loop using the index to count through but I'm not sure if how to start it.This is how the text file that he wants sorted out looks.
Ally Gators:Tim Tebow:240:280:250
Ally Gators:Albert Gator:150:175:222
Ally Gators:Joe Cool:195:220:217[code]...........
View 20 Replies
Nov 15, 2009
I am trying to read from a file that was created with a stream writer the names line from the text file that contains data for name, phone number, pager number, cell number, voice mail, and email.What I need to do is read and load the names from the file into a list box, and then from the list box be able to choose each name and have the information (phone, pager, cell, etc.) show up in text boxes that goes with the specific name.
View 4 Replies
Mar 6, 2010
I'm trying to make a form that will read my wordlist. txt (one word or phrase per line) then using a timer, insert one word randomly selected from the list, and display it in textbox1 where it will remain until another timer changes the word. The word in the textbox will display for a random time 1min to 7 min, then the textbox displays another word randomly selected from the word list.
View 1 Replies
Dec 31, 2011
I want to get some HTTP source with VB.net. The page is huge though, so it would suit me to pull it in chunks. I'm also already reading about the VB.net background worker. So far I'm using this code: HTTP GET in VB.NET but my program stalls while it loads the page, for a decent amount of time. The page to get is http://ftp.drupal.org/files/projects/, but don't go there unless you absolutely have to.
Should I stick with the background worker, and/or is there a way to split up the HTTP request?
View 1 Replies
Jan 4, 2012
I want to read sms from datacard and want to store in the database how can I solve this problem I used AT-Command in c#.Net but only success to send sms from mobile but not read from mobile or sim . same thing I want to implement in datacard using c# or vb.net .
View 5 Replies
Jan 11, 2010
I have a jpeg file in my C drive from my vb.net application I want to binary read it and store it in SQL server.
View 1 Replies
Sep 2, 2011
What I am trying to do may be better for use with SQL Server but I have seen many applications in the past that simply work on text files and I am wanting to try to imitate the same behaviour that those applications follow. I have a list of URL's in a text file. This is simple enough to open and read line by line, but how can I store additional data from the file and query the data?
E.g.
Text File:
link1 - 0
link2 - 0
link3 - 1
link4 - 0
link5 - 1
Then I will read the data with:
Private Sub ButtonX2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX2.Click
OpenFileDialog1.Filter = "*txt Text Files|*.txt"
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Dim AllText As String = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
Dim Lines() = Split(AllText, vbCrLf)
[Code] .....
Am I going completely the wrong way about storing the data after importing from a text file?
View 3 Replies
Mar 30, 2011
There is an OLE object column that contains images in my access database. I'm trying to create a program that reads the images from that ole column and store the images to a file. Currently, I have a program that creates an image file but the image is blank.[code]
View 2 Replies
Mar 22, 2012
I am coding a program that will allow the user to input 5 payrolls for Store 1, Store 2, and Store 3. The total of the 5 payrolls are then added together and shown in the respective Store's labels. A total label is also there to add up all the totals into one number. The numbers in the label must be in currency form. My problem is the numbers don't add correctly when I hit calculate. The first two numbers add together, but then after that the number just seems to subtract a random amount.
So far I have this --
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
[CODE[...
View 14 Replies
Mar 23, 2010
I have a class with a lot of methods. This class and methods are in one file. These methods can be put into 3 groups based on the things that they can be used for. What would be a good way to break these methods up into the 3 groups? I was thinking about doing a partial class definition and breaking up these methods into 3 files.
View 3 Replies
Aug 17, 2010
I have a set of points. The connections among them areenerated. How can Draw lines between theconnected points?In the example below, Plist is the connection list among them. How can I store points to PList so that it draw lines?
Public Class Form1
Dim Matt(7, 7) As Integer
Dim NumberofConnections As Integer
[code].....
View 4 Replies
Jun 23, 2011
I just wondering if Visual Basic.NET and VB6 can do these examples.I have use python before and i will take some examples.Save numbers to a list and add
Quote:
this_is_a_list=[1,2,35,4564,532,2454,3404,3,455,2,1]
x = len(this_is_a_list)
this_is_a_list.insert(10, x)
len is a function who count how long a list is. This list is 11 numbers long. I will now insert/add number 10 after the last number. The first number has the place 0. The second number has the place 1.Can VB.net do that? Check how long a list is?Delete a list?
View 9 Replies