Multithreading - Threadsafe List - Parse The Data?

Jan 19, 2011

I have a List(Of Byte) that is filled with bytes from the serial buffer on a SerialPort.DataRecieved Event. I then try to parse the data. Part of the parsing process involves deleting elements of the List(Of Byte). Should I be concerned about the List being modified by a DataRecieved Event that might be raised during the parsing process? I realize that probably depends on what I'm trying to do, but, assuming I should be concerned (e.g., the parsing process needs List.Count to not change until parsing is finished), how should I go about making sure any Add calls wait until the parser is done? I guess the answer is something like SyncLock, but I've never really understood how SyncLock works.

View 1 Replies


ADVERTISEMENT

.net - Multithreading Function To Implement Threads Fetching From A List Of Urls To Parse Content?

Feb 2, 2010

I have the following multithreading function to implement threads fetching from a list of urls to parse content. The code was suggested by a user and I just want to know if this is an efficient way of implementing what I need to do. I am running the code now and getting errors on all functions that worked fine doing single thread.for example now for the list that I use to check visited urls; I am getting the 'argumentoutofrangeexception - capacity was less than the current size'/Does everything now need to be synchronized?

Dim startwatch As New Stopwatch
Dim elapsedTime As Long = 0
Dim urlCompleteList As String = String.Empty

[code]...

View 2 Replies

Are User Events Threadsafe

Jan 30, 2010

I have a sub that handles onClick and a sub that handles onKeyDown so will the 2 functions ever run synchronously or will they be surely be asynchronous without me having to synclock both blocks of code?

View 8 Replies

Is LinkedList Implementation Of .Net Threadsafe

Apr 26, 2011

I am working on an application which uses multiple threads to work on number of tasks and the parent application receives the output of the task,later to be written to files, currently I am using arraylist to append output to, but that happens to be slow when removing items from queue.I was thinking to convert arraylist part to linkedlist for optimized reads and clears,if linkedList Implementation of .Net is threadsafe or even using arraylist was threadsafe?

View 3 Replies

Parse A List Of Web Addresses In A Textbox?

Apr 14, 2010

I'm trying to parse a list of web addresses in a textbox.The textbox looks something like this:

Some bunch of paragraph here http:[url]...robert some stuff here

some stuff http:[url]....some sentences etc etc So what im trying to do is parse that string and get all strings that has http:// in it and show it in a listbox. Can it be done?

View 2 Replies

VB 2010 - Multithreading - Missing Some Data That Is Streaming

Nov 24, 2010

I am developing a software that catches streaming data. Unfortunately, there is no pattern or sequence on how this data comes in. So what I have initially done is to catch then write to my MS Access DB. Unfortunately, while writing to the DB, I am missing some data that is streaming since writing takes a little bit of time before it goes back to the catching syntax.

I am planning to multithread the DB writing then just call it from my main program. Do guys know any website/tutorial where I can learn the basics for multithreading? I am using Visual Studio 2010. Or if ever, does any one of you have a sample program where I can just learn from?

View 6 Replies

Multithreading, Events And Cross Thread Data Sharing?

Dec 1, 2011

I am building a code library to be used by a 3rd party developer. Neither my code or the 3rd party have any UI controls involved. It's purpose is a combination of providing the ability to look up information from a database while at the same time polling it and throwing events when a set of conditions are met. Naturally the only way it's going to be responsive to the 3rd party library's commands is via multithreading since everything in a single thread stops once you start polling the database.

The sub I am using is part of an object that I create in the main thread and attempt to have it run via a thread, when a condition is met I have it update a property in that object, throw the event (or execute a callback in my latest attempt) and then attempt to have a simulator for the 3rd party control read the property.It's easy to setup the multithreading part, the hard part appears to be throwing the event so it is seen in the original thread and the data is available there. Any attempt to do this generates a cross thread error when the data is read.

I attempted to use delegates and calling methods asynchronously and using the callback function but still get cross threading errors.Is my only possiblity to use a background worker, using either the progress changed or runworker completed events? Even then am I going to be able to set the property in the function from one thread and read it in another?

View 1 Replies

Multithreading - .NET DataGridView Load Data From A Background Worker And SQLDataReader?

Mar 28, 2012

I have a DataGridView that I'd like to load with data that I'm retrieving from a SQLDataReader running in a background worker as the data comes in (it's a query that takes a long time). My goal is for the user experience to be similar to searching for a file in Windows where the results appear in the list as they come in and you can still interact with the window.

I have it working with a background worker and data reader and I'm trying to add the row from the SQLDataReader.Read through using the BackgroundWorker.ReportProgress method. Everything technically works but the flicker is crazy and the form is unusable (probably not because the GUI thread is blocked but just because there's so much going on...) How do I make loading the datagridview "smooth"?

View 1 Replies

Multithreading And Status Bar - Simple "tasks List"

Apr 4, 2011

Haven't played with .NET for a while thought I would build myself a simple "tasks list" for work basically to "brush off the dust". Windows Form + MySQL

Now on form load I wanted the program to automatically try and connect to the DB. No problem except the DB connection always delayed the program launching by roughly 5 seconds. So I figured a separate thread call to take the stress from the form ... and now I'm floundering ....

CODE:

simple enough on form load display the dynamic text to the status bar label named dbStatus. Than start a new thread to the address of my database connection function. This works fine, i can even throw a msgbox() inside the function and can be told its connected. But in that same function I add the line

CODE:

Commented lines were me trying to reference it a "different" way ... but every time I run this the label never gets updated, when i step through set function the 'InvokeRequired' is either nothing or false.

But of course directly trying to access the text attribute of the label doesn't work but strangely enough doesn't throw a cross thread error either.

Hence my current dilemma ... I can directly call db.ConnectDatabase and everything works as intended .. when I throw the function into a separate thread my status label never gets updated, nor am I warned about any cross thread operations.

View 9 Replies

How To Parse XML Data

Nov 1, 2009

I have XML data like this:[code]I would like to return the name of the places. How may I extract this data using Visual Basic?

View 3 Replies

Parse Data From One .net App To Another?

Jul 29, 2010

How can I actually send a string or another variable on the run to another running .net app? I searched google and found nothing really,

View 3 Replies

Parse XML Data From Web

Jan 11, 2012

I'm trying to parse data from the web, basically, from an API rl...How do I approach this? Could I use XMLDocument to do this or MSXML2? [code]I've only worked where the node root doesn't have the name of the thing I need. So, how would I specifically retrieve the data for the node symbol? [code]

View 2 Replies

How To Parse Column Data

Mar 19, 2010

I am trying to parse a file generated by LGA Tracon that lists the position data for aircraft over a given time frame. The data of interest starts with TRACKING DATA and ends with SST and there are thousands of entries per file. The system generating the file, Common ARTS, is very rigid in its formatting and we can expect the column spacing to be consistent. Here is an image to preserve the exact formatting Here is a reduced text file.

View 2 Replies

How To Parse Text Data From URL

Aug 19, 2011

We are using the following code to try to parse some text data from the URL below:
Dim strURL As String = "[URL]"
' *** Establish the request
Dim loHttp As HttpWebRequest = DirectCast(WebRequest.Create(strURL), HttpWebRequest)
' *** Set properties
loHttp.Timeout = 10000
' 10 secs
loHttp.UserAgent = "Code Sample Web Client"
[Code] .....

The problem is that the response we are getting in code is incomplete when compared with what actually renders in the browser. The html we are getting shows a javascript function in the body of html where what we really want is the result of the function, which includes the data we need to capture. This is confirmed by loading the page in Google Chrome, clicking on the text "100360" and choosing "inspect element" which allows us to see the full page response with the data we need, specifically the following line:
<pre class="pre-longText-wrap">100360</pre>

How to get this "raw" page response? It may be that the script is taking a few seconds to respond and that we are only seeing the initial page response.

View 1 Replies

Parse A Webpage And Get The Data?

Apr 18, 2009

I am trying to parse a webpage and need to get the data basically the string i am looking for in a webpage looks like thisSomeone lead me in the right direction in parsing the Stuff strings?

</b></a></td><td align="left" bgcolor="#F6F6F6">Stuff1</td></b></a></td><td align="left" bgcolor="#FFFFFF">Stuff2</td></b></a></td><td align="left" bgcolor="#F6F6F6">Stuff3</td></b></a></td><td align="left"

[Code].....

View 6 Replies

Parse(receive) The Data From The PBX Itself?

Feb 3, 2012

have to write a program/application (which I already started in VB.NET 2010) that connects through Panasonic KX-TEM824 PBX machine via RS232 port (cable already connected : COM15/16 depending on USB I connect) and while it's connected to parse(receive) the data from the PBX itself, data that has caller ID, time of call started and ended, duration of the call and etc. I have found some already application on the Internet that does the work but they are free to try after awhile requires to buy or restart the app again. But I assume there's not much to implement on the code side.

Imports System
Imports System.ComponentModel
Imports System.Threading [code]..

View 7 Replies

Richtextbox1 To Parse Data?

Oct 5, 2011

I'm trying to create a quick little program in VB 2008 that can parse extract the google search results based on the search criteria of the user input.

Basically what I have is a textbox1.text that enters the keywords into google, google will then put the url results back into my richtextbox1.text.

Here is the code that I have:

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Me.Text = WebBrowser1.Url.AbsoluteUri

[Code].....

View 3 Replies

How To Parse Data From A SQLite Database

Apr 2, 2009

I'm writing a program that needs to parse data from a SQLite Database, I have the reference DLL but I do not know the proper syntax for the actual parsing of the file. The reference I have is located at [URL]..I don't really see any code that would need to be given seeing as the code for that class is currently something link:

Imports System.data.SQLite
public class SQLite
public sub Retrieve_Data
end sub
public sub Connect2SQLite
end sub
end class

View 1 Replies

How To Retrieve And Parse HTML Data

Oct 19, 2005

In VB.NET 2005, what is the best way to retrieve and parse HTML data from a URL, a bit like a search engine crawler?I am building an app, where I need to parse a website, and collate data from it (the website uses some tags that I could pull out to get the appropriate bits of data). I want to be able to do this in a thread, and just update a DB with the data, and give the client app a status update of the progress.

View 6 Replies

Parse String Data In Double?

Jan 13, 2010

I have a text reader and I wish to parse the readline string data in double.[code]...

I do not necessarily wish to define the split to interpret double space as separator as I do not know whether this is always the case. I would rather like to tell the program that there are three double format numbers -> go and parse.

View 1 Replies

Parse Data From A Command Line Tool?

Feb 19, 2010

is there a way to parse data from a command line tool such as netstat -b 2?

View 2 Replies

Asp.net - Parse Data/numbers From Table Cells C#?

Dec 10, 2011

I have a string which contains html code from a webpage. There's a table in the code I'm interested in. I want to parse the numbers present in the table cells and put them in textboxes, each number in its own textbox. Here's the table:

<table class="tblSkills">
<tr>
<th class="th_first">Strength</th><td class="align_center">15</td>
<th>Passing</th><td class="align_center">17</td>

[code]....

As you can see there are 14 numbers. To make things worse numbers like 19 and 20 are replaced by images and numbers lower than 6 have a span class.

View 2 Replies

Parse A XML File And Spit Data Into Reports?

Oct 25, 2010

I have an XML file that I need to parse to generate a few reports. What needs to be done is pretty simple, but I have no clue where to start with parsing the XML.The application will do this:Click a button to browse to an XML file where the format is static. Once the file is loaded, parse the file and generate a report using specific fields from the XML file. Criteria will be based on State(completed or incomplete), activity(Inspection, sample, etc). Here is 1 record of the XML file. Each consecutive record uses the exact same format.

<AsBuiltXML xmlns:lx="http://www.***.coml" version="1.0" date="10/20/2010" time="8:07:52 AM">
<Project name="S. 88th Street" desc="" />
<Units>

[code]....

View 7 Replies

ScriptSerializer Unable To Parse Data Type

Sep 20, 2011

I have some JSON data that looks like this[code]...

I get one root object with key "data", and value another object with 2 children, with keys "name" and "id", and the appropriate values one might expect. But when I try to cast that object to my UserData type, it returns Nothing. I had this code working at some point, but now that I am returning to it and attempting to use it again, it seems some code rot has set in and it has stopped working.

View 1 Replies

VS 2008 Connect To TCP Data Stream - Rcv And Parse

Jul 2, 2011

Everyone seems to have their own TCP dilemma so I figured I'd ask this here and see what the pros have to say. Basically I need to connect to an IP 192.168.5.100, port 8000 and listen for all the data that is being sent out. When I Telnet to 192.168.5.100 8000, it shows as...

[Code]...

View 1 Replies

C# - Parse An Expression And Retrieve A Parse Tree?

Jun 8, 2012

I just want to parse simple expressions like IIF(FVAL(PFC) = TRUE, (IIF((ORGVAL(BAS, "2012/12/31") + ORGVAL(DA)) < 6500, (FVAL(BAS) + FVAL(DA)) * 12%, 780)), 0)`After parsing this I should be able to know what functions contains what parameters.

[Code]...

I'm stuck with .Net Framework 2.0, so no Linq or lambda expression goodies for me. Also I want to include the code in my custom library and not just reference it. Can anyone point me to some good library or code.

I just need to parse and not evaluate the expression and find what tokens are in use. After finding the tokens I need to change the expression string before parsing, like if the function ORGVAL is used then the parameter passed has has to be prefixed by an underscore. Like ORGVAL(BAS) will transform to ORGVAL(_BAS). Some functions can have tow parameters like ORGVAL(BAS, "2012/12/31") and this will transform to ORGVAL(_BAS, "2012/12/31")

NOTE: IF THERE ARE OTHER WAYS OF DOING IT PLEASE LET ME KNOW. I WOULD LOVE TO AVOID A PARSER AND LEXER.

View 3 Replies

Parse Data From Html Table Cant Display In Listview?

Nov 7, 2009

Here is the code I am playing around My problem is parse data from html table can;t display in my listview It always display in first column only.

[Code]...

View 4 Replies

Regex - Regular Expression To Parse Whitespace-delimited Data?

Jun 18, 2009

I have written code to pull some data into a data table and do some data re-formatting. I need some help splitting some text into appropriate columns.

CASE 1

I have data formated like this that I need to split into 2 columns.

[Code]...

column is the first 11 characters That is easy.column 2 should contain all the text after the first 11 characters up to but not including the first number.The last column is all the text after column 2

View 4 Replies

Read From Serial Port And Parse Received Data On Event Serialdata.eof?

Nov 2, 2011

I'm having trouble with parsing an XML data from serial port.Actually I need to parse it automatically after all data is received from serial port.I can display all the data in a richtextbox control and all data is received perfectly but my problem isit seems that serialdata.eof function seems like it's not firing.

here's some of my code:

Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'set serial port properties
With COMPort
.BaudRate = 19200

[code]....

what i need to know is how can i automatically parse the XML data from serial port after all data is received.

View 8 Replies

VS2008 Load And Parse A Text File And Extract Data Between Points On Any Given Line

Apr 4, 2010

I need to load and parse a text file and extract data between points on any given line. I can load the file, but it's the parsing that's giving me headaches. e.g. "Phoned Jim and arranged for John to attend site" First I need to search for "Phoned" because the line always starts with that, and then I need to extract "Jim and arranged for John"

[Code]....

View 5 Replies







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