|
Mmmm it can be interesting... tomorrow i'll try it because now is time to go to sleep
Seriously, because that program is for me and not to sell it I haven't thinked about RAM Anyway, I say you what the program does.
Well what the program does is to take the text that i want of all the text file. In each text file there are a lot of lines and in each line there're some data separated by commas representing they're columns and what i want to do is to take the "columns" i want of each line (well it will be the same columns for all the text file) and then seprate again them by commas and saving in an other text. In other words, i erase the columns i don't want of an input file. That's why i splitted the text every 400 lines because i thougth i'd be useful but if don't how will you do it? If i don't do anything of multitrheading the programs seems that frezees but if you led it it will end the job after a long time but it's much time...
Thanks for your time!
|
|
|
|
|
OK, having read the details now, I would not change a thing on your app.
Look at Task Manager's performance pane and estimate average CPU load, lets say it is about 100%/Q (if Q is large, look again at your single-threaded code; don't use any Q higher than 5).
Now split the files into Q folders, and run Q copies of your app at the same time, each dealing with one folder. That is about the best you will ever get, but now you get it without much ado.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Some suggestions that may improve performance, and are applicable to a single-threaded or multi-threaded app:
1.
don't use regexes for this, they are powerful however they are slower than simple string logic;
2.
don't use string.Split() if all you need is one part
Hence, use an overload of string.IndexOf() to find the Nth comma; use another IndexOf() to find the next one,
then use string.SubString
BTW: this would fail if fields also have embedded comma's (e.g.within quotes), but so would Split().
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Hi,
multi-threading will increase overall performance as long as:
1) you have idle cores (e.g. your system is a quad core and there mainly is a single app, which isn't multi-threaded at all)
2) or your active cores are not fully loaded because a lot of time is spent waiting on something (disk I/O, network I/O, etc).
You can check both by looking at the performance pane of Task Manager while your current app executes. If the CPU load is near 100%, threading won't help you at all. If it is near 50% on a dual-core, at best threading will double the speed. etc.
Keep in mind that multi-threading has its drawbacks too:
- an N-core system is not N times as powerful as a single-core, because a lot of resources are shared (main memory, some of the cache, all input/output devices, ...).
- thread synchronization (locks, mutexes, whatever) come at a cost.
Conclusion:
- if your CPU load is way below 100%/N for an N-core system, it is waiting a lot, and more threads may (or may not) remedy that;
- if your CPU has N cores, multi-threading (up to N) may or may not provide a speed increase up to N.
- most often the first thread you add is the biggest step forward.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Is there any way to turn off the sound in your form?
|
|
|
|
|
Don't start another thread on the same subject. No, there is no way to turn off the sound "globally" for an entire form.
|
|
|
|
|
Okay sorry, but it wasn't entirely the same. It was talking about the whole form.
|
|
|
|
|
|
|
Okay I have a form, where when you type in the textbox it shows up automatically in a live web browser view, and when you type in the textbox the little clicky sound comes up. I need a code that will stop the sound. Please and Thank-You!!
|
|
|
|
|
What clicky sound? The TextBox doesn't make any noise when you type.
It's possible that the browser is making a clicking noise every time you set its Document property. There is no code to turn that off.
|
|
|
|
|
Well then it's the browser sound probably... but I was making a browser, and I had to press enter on the search box. It made a sound, but then I added a code, and the sound stopped. I tried the stoping sound with this and it didn't work. So their should be a code. I think. Thanks.
|
|
|
|
|
thebiostyle wrote: but then I added a code, and the sound stopped.
You're going to have to show that code. I get the feeling that you don't understand what it does and think that it'll apply to the brwoser as well.
|
|
|
|
|
If e.KeyChar = Chr(13) Then
e.Handled = True
End If
|
|
|
|
|
That's not going to work for any control other than the TextBox.
|
|
|
|
|
thebiostyle wrote: and when you type in the textbox the little clicky sound comes up. I need a code that will stop the sound.
You don't use code the way one would use aspirin - it hurts here, gimme a patch. You might want to start by researching whether the sound is coming from your application, or from something else.
I bet it's coming from the operating system. Are we talking about the standard Windows-sounds?
I are Troll
|
|
|
|
|
Hi,
I have created two columns in my database, "Name", "Payment1", "Payment2".
While creating the columns, I checked "Null" option, because of which it shows "Null" entries under my column "Payment1" if I am not filling anything.
But I want to fill "0" (Zero) in those empty fields of "Payment1" column, so that I can update it later on.
Also I have to add entries of column "Payment1" & "Payment2" Values, so that I can get a total payment.
Anyone can help me on this?
Thanks
R.S.
|
|
|
|
|
Change the existing columns to not null, and set the 'Default value' to 0
When you add the new columns ensure you set the default value and not null for them as well.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
CREATE TABLE Table1
(
Name varchar(50),
Payment1 int NOT NULL DEFAULT (0),
Payment2 int NOT NULL DEFAULT (0)
)
|
|
|
|
|
I have to add entries of column "Payment1" & "Payment2" Values, so that I can get a total payment and write the sum in another column "Total Pay".
How to Add these two columns using UPDATE? Is there any other way to update theese two columns and write the sum in another column "Total Pay" ?
|
|
|
|
|
ALTER TABLE Table1 ADD TotalPayment int;
UPDATE Table1 SET TotalPayment = Payment1 + Payment2;
Although, this is a bad practice since it violates principles of normalization
|
|
|
|
|
Hi,
I am adding two columns in "payments" table in database. Column A & B. These two are added and updated in Column "Total Payment". The code I wrote is below, its not updating the sum of A & B in column "Total Payment":
cmd = New SqlCommand("Select * FROM payments", con)
If con.State = ConnectionState.Closed Then con.Open()
myDA = New SqlDataAdapter(cmd)
Dim myDataFinalPaySet As New DataSet()
myDA.Fill(myDataFinalPaySet, "payments")
Dim TotalPaymentValue As Double
Dim TaxablePayment As Double
For Each dr As DataRow In myDataFinalPaySet.Tables(0).Rows
Dim ValA As Double = dr("A")
Dim ValB As Double = dr("B")
TotalPaymentValue = ValA + ValB
If con.State = ConnectionState.Closed Then con.Open()
cmd = New SqlCommand("UPDATE payments SET [Total Payment]= '" & TotalPaymentValue & "'", con)
cmd.ExecuteNonQuery()
cmd = New SqlCommand("Select * FROM payments", con)
myDA = New SqlDataAdapter(cmd)
myDA.Fill(myDataFinalPaySet, "payments")
DataGridPayment.Update()
con.Close()
Next
Can Someone help me onthis?
|
|
|
|
|
Use IsNull on the second column when adding.
Payment1 + Isnull(Payment2,0)
This belongs in the general database forum.
|
|
|
|
|
I have to add entries of column "Payment1" & "Payment2" Values, so that I can get a total payment and write the sum in another column "Total Pay".
How to Add these two columns using UPDATE command? Is there any other way to add these two columns and write their sum in another column "Total Pay" ?
|
|
|
|
|
You need to read BOL and get some idea what you are doing. This is a very basic problem that is exampled throughout the doco.
Update TableName Set TotalPay = Payment1 + IsNull(Payment2,0)
Never underestimate the power of human stupidity
RAH
|
|
|
|