Perform Two Hashing Operations Concurrently On A Single File Without Reading The File Twice?

May 18, 2011

I want to perform two hashing operations concurrently on a single file, without reading the file twice. Is there some way to share the FileStream between two synchronized hashing threads? For example:

Dim Stream As New IO.FileStream("...", IO.FileMode.Open)
Dim HashA, HashB As Byte()
Dim A = New System.Threading.Thread(Sub()

[code]....

Maybe some way of caching a stream? Trouble is, I don't want the entire file in memory at once (it could be many gigabytes in size) and I don't want the file read more than once, due to speed issues. I want the file cached only sufficiently to ensure that both threads can work.For example, suppose at some point in time, thread A had read 100k of the file, but thread B had only read 20k of the file. The portion of the file between 20k and 100k should be cached; but then progressively forgotten as thread B catches up. Then again, if thread B is too slow, we might still end up with hundreds of megabytes being cached.Maybe thread A should be made to wait while thread B catches up. Maybe the ReadByte() function of the stream should block for a while if one of the threads is too far behind?

View 13 Replies


ADVERTISEMENT

Office Automation :: Load Excel, Perform Operations And Then Show File?

Feb 28, 2010

I'm trying to figure out some Excel automation. I have a form set up so the user can click on a label to open an Excel file (as a background process I guess) so the file isn't actually visible. Once they click on the "Convert to Count" button it will multiply all the values in Column B by 1,250 and put the output in Column C. Once it has finished this action, it makes the file visible so the user can choose to save it or not. Also, some users have Excel 2003 and some have 2007. Would it be possible to be able to load both xls and xlsx?[URL]..I must say I am very new with .NET and have a little bit of knowledge with VB6. I'm not sure where to even begin. I've looked up some ways to load an excel file but couldn't get it to work the way I need it to. Most of the ways I found were loading the file into a DataGridView. I don't want to use a DataGridView if I don't have to. Some of the files the users might be loading could have 10,000+ rows and that would take too long I think.

View 3 Replies

VS 2008 - Hashing A File - Using The SHA256 Algorithm

May 6, 2009

I know I can MD5 hash a file, but how do I go about using the SHA256 algorithm?

View 6 Replies

Using Expressions To Perform String Operations (contains - Startwith)

Nov 8, 2011

I'm trying to make a generic filter for data overviews and I've come across expressions. In that example, some expressions are used to do comparisons:

[Code]...

View 2 Replies

Writing A Program Which Has To Perform Several Operations On Data Exported From A CAD Software?

Nov 11, 2010

I'm writing a program which has to perform several operations on data exported from a CAD software.The amount of data to be processed is huge and even by simplifying the program at maximum it will still take about 10-15 minutes for average models.

The operations are performed on an array from the first to the last element. Let's say for a list of 10 elements (as example) that I start from element 1 and I finish when element 10 has been computed. I thus thought that since I'm working on a 8 processor machine would be convenient to make use of multi-threading. My idea is, for the case of 10 elements, to make thread1 working from 1 to 5 and make thread2 working from 6 to 10.I already wrote a working code for a 2 thread process which is working, but I want to extend the number of threads and eventually decide in function of the threads available. The basic structure is given below:

[Code]...

View 9 Replies

File I/O And Registry :: Safe & Secure Way To Perform File Transfering Between Computers?

Feb 5, 2009

My application runs on a "server" machine and provides files (10megs - 100megs each) to 8 other computers. Currently this is done using a standard shared folder on all 8 computers and the server simply copies the file to \ComputerNameSharedFolder - and everything is great.However, due to new policies we need to remove all shared folders, so using a simple \ComputerNameSharedFolder is no longer feasible. Therefore I need to find a way for my application to be able to share these files in a safe, secure, and compliant way.There has been talk of using sFTP which would require each system to have an sFTP server running at all times (controlled by the application somehow), or also SSL was talked about as it can be integrated into the application easily, etc...

View 1 Replies

Multiple Operations Using Single RecordSet?

Jun 18, 2012

I have some task regarding do operations on database using ADODB in Vb.NET.regarding using the same record set multiple times?

I have tried on this topic just by closing the recordset after performing First operation and doing second operation e.t.c.

In ADO.NET we have "MultipleActiveResultSets=True" in ConnectionString for SqlDataReader.Do we have any property like this in ADODB?

View 1 Replies

File I/O And Registry :: Binary File Primer - Read The Nth Record Without Reading The Whole File?

May 4, 2009

I need to write data to a file, preferably in binary format, but I am unaccustomed with the concept. Where's the easiest place to get the basics? I could come here with a specific need, but I'm at the point right now where I am more willing to work within the confines of keeping it simple.

Here's what I know:
1. how to open a new file
2. how to specify the record length
3. how to close the file

Some specific questions:

Does the record length have to be constant throughout the file?

Can I read the nth record without reading the whole file?

View 8 Replies

VS 2010 4 Math Operations ONE Single Time

Sep 19, 2011

I need to creater a menu that will offer 4 operations ALL at once by using & vbcrlf [code]heres what i was able to do but it shows all the 4 operation in my msgbox..

View 2 Replies

File Operations Return Before Completion?

Jun 5, 2011

The file operation calls are returning before they are actually complete, or the disk is being cached somehow. What is happening here is that a zipped file containing a number of files to be updated on the users machine has been unzipped and the filenames are returned in an array called 'newfiles'. Each actual file unzipped is temporarily preceded by a '~' character. We rename each existing file to <filename>.old, then delete all the old files. However, sometimes when the code runs, the old files are not deleted. The only explanation for this I can think of is that the second 'Fileexists' is not seeing the files because the filesystem has not caught up at that point. I've never seen this behaviour documented anywhere, though. It works fine when single-stepped.

For Each fn As String In newfiles
If .FileExists(fn) Then
'rename existing file to .old
delpath = Path.ChangeExtension(fn, "old")
.RenameFile(fn, delpath)
End If
'rename the new file to correct name i.e. remove "~"
[Code] .....

View 9 Replies

File I/O And Registry :: Reading File Properties Without Loading File

Sep 19, 2010

I want to be able to able to read the dimensions of a TIF image without loading the entire file.

PS Using Visual Basic 2008 on Vista64.

View 11 Replies

Make The Connection For Threads To File Operations?

Nov 28, 2011

I have a small code that can start multiple threads in numerous numbers and these threads will perform some calculations and file operations (read and/or write) that are private to themselves (each of the calculations and file operations are independent).But I can not figure out how to make the connection for threads to file operations.

View 2 Replies

Put Frequent File I/O Operations Within A SyncLock Block?

Sep 14, 2009

Say I have some code that does this:

Public Function AppendToLogFile(ByVal s As String) As Boolean
Dim success As Boolean = True
Dim fs As IO.FileStream = Nothing

[Code].....

First of all: is it a problem that I have that Try/Catch/Finally block inside of a SyncLock?

Second of all: suppose this code runs, on an event, potentially many times within a small timeframe--say, ten times in one second. Is it OK to have it SyncLock like this, or would it make more sense to have it add a line to a Queue, and then write all the lines from the Queue to the file on a timer that goes off, say, every second?

View 2 Replies

Text File Read/write Operations?

Nov 29, 2010

I am currently working on an application which requires reading, writing and modifying data from a TEXT file. I have searched a lot but was not able to find a simple way to achieve this. I have to use a standard VB form with textboxes for ths text file opearations. s

View 1 Replies

Question Atomic Operations In .Net Or Checking File For Lock?

May 17, 2010

I would like to know if there is any opportunity in VB.Net to use atomic operations. Or Maybe there is an opportunity to check if a file is allready in use or opened.The reason why I ask is because I got a little application that I would like to log its actions. As the applications uses threads the method for writing the log file sometimes is trying to open the log-file more than once which leads to an exception.

View 3 Replies

Text File Read / Write And Modify Operations

Nov 29, 2010

I am currently working on an application which requires reading, writing and modifying data from a TEXT file. I have searched a lot but was not able to find a simple way to achieve this. I have to use a standard VB form with textboxes for this text file operations.

View 2 Replies

Forms :: Get A Record And Then Use Value Of That Record To Perform Some Operations

Oct 20, 2011

Basically i am making a software that will be interacting with a database (sql).Now what i wanted is a loop which after every 30 minutes, connects to the database finds some info and executes a bunch of statements.For the sake of testing i have made the timer tick at 1 second, and display a record in a database in a label continuously just to see if it works (i will later make the tick 30 min)Now this is what i have tried till now , it prints the record in database perfectly after 5 seconds, but after that just fails.[code]I want to infinitely make a loop in which after every 30 minutes has passed it would connect to the database get a record and then use the value of that record to perform some operations. And this has to be done in the background.

View 2 Replies

Make Application 'single File' And Get Rid Of XML Config File?

Dec 29, 2010

I have this pretty simple application, it uses a webService to transfer data to my servers DataBase. Now it is very important for me to keep this application as one single file, and not having some XML files needed for it to work, but this is the case. I think the XML file holds the information to this webService, so without it the application crashes. Is there a way to get the application to work without this XML file, or a way to put the XML inside the exe archive?

View 1 Replies

Merge An Exe File With A Dll And Make It A Single Exe File?

Jan 12, 2010

I have an .exe file which is using a .dll file.I want to make an .exe file which will do the work. The reason I want to do this is to hide that dll file from the user.

View 3 Replies

Native .NET To Unzip Single File From A .ZIP File?

Oct 28, 2010

extract a single file (WantedFile.xml) from a .ZIP file (THEBIGZipFile.zip) using native VB.NET Code?I think .NET FW 3.5 or 4.0 has "System.IO.Packaging.Package " which can be used? Not sure. Please advice.

Note: I will not be able to install or distribute any other DLLs like (ICSharp or VJ# or cant use process command to invoke winzip etc).

View 4 Replies

Reading A Text File Into A Checked List Box Through The Open File Dialog?

Apr 4, 2011

I have a checked list box that is populated with the text from a text file. I started off with this code:

Dim FileToLoad As String
FileToLoad = TextBox3.Text
Dim fs As FileStream = New FileStream(FileToLoad, FileMode.Open)

[code].....

View 3 Replies

VS 2005 Perform A MySQL Query To Get A Single Record (searched For By ID?

Jul 8, 2009

I want to know if it is possible to perform a mySQL query to get a single record (searched for by ID) and then split each field into a seperate text box.I think im ok with the SQLQuery to get the record. its the splitting it into individual text boxes that im strugling with.

View 1 Replies

File I/O And Registry :: Reading A HTML File And Replacing Certain Parts?

Nov 5, 2010

friend of mine has no HTML knowledge so I'm attempting to write a program that replaces certain parts of a html file to suit his needs.I've edited the HTML file and marked certain parts with "tags" like this:

#IMAGEURL1# I have a textbox where he can copy + paste an image URL and hopefully the #IMAGEURL1# is replaced with the contents of the textbox.

So can someone please enlighten me to-as how to open a HTML file (there's no textbox to display the contents just yet, I'll add one if needed), find the specified text and then replace it with whats in a textbox.

View 1 Replies

File I/O And Registry :: Reading TAB Delimited File Using MS Text Driver

Jun 14, 2011

I am trying to import a TAB (NOt comma) delimited text file into a DataGridView. The following code works fine if I have a comma separated file. All I have to do is change the FMT to "Delimited".It just does not work with FMT=TabDelimited. All columns are read into single datatable column. The text file is ANSI text and I have double checked to make sure Tabs are tabs and not spaces, even exported a sample Tab Delimited file from Excel.Can this even be done using Text Driver? [code]

View 2 Replies

Play A WAV File While The Computer Is Reading Aloud A Text File?

Nov 20, 2010

How do I play a WAV file while the computer is reading aloud a text file? It uses Text to Speech synthesis and I need a laughter wav to play when the computer comes across something funny in the line.

View 2 Replies

Unable To Perform Copy Of File In VB 2008

Jun 12, 2011

I am trying to copy a file from 1 location to other location with a new name. The new name should be like "Oldname + date & time". I wrote the following code but getting error that the Given path format is not supported Imports System.IO[code]...

View 2 Replies

File I/O And Registry :: Reading File 2008 Express

Nov 19, 2008

I'm new to Visual Basic. I'm trying to get this code to read a .txt file line by line. If the only thing that the line says is "B" it should add one to the intTotalBoys integer and so on with G for Girls, F for Fathers, and M for Mothers. I'm not sure why it won't work. [code]

View 4 Replies

File I/O And Registry :: Reading From A File And Ignoring Comments?

Oct 28, 2009

I would like to read from file, and ignore lines that start with --. I know how to read line by line but i just need to ignore those lines.

View 3 Replies

File I/O And Registry :: Reading/Writing Objects To File?

Jul 5, 2009

So I need to write out an object to a text file as well as read in objects from text files.How do I accomplish this? This is the code i've used to read and write just simple lines of text. Is there a small modification to this or just a different function i use to read in an entire object?

Code:
Dim path As String
path = "Security.txt"

[code].....

View 4 Replies

File I/O And Registry :: Text File Reading And Writing?

Jul 17, 2010

I have just recently been using VB 2010 after using VB5. I have noticed a lot of changes. The problem I have is that I wish to open and save text files to and from arrays in the background. I've attached what I would do in VB5. I have searched around, but all the examples I find use a Textbox instead of an array. Can anyone show me how I can do this with VB 2010?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved