|
Eddy Vluggen wrote: Research the StringBuilder and read up on Regular Expressions Smile
I already done that, It says this is only useful if you are performing operation on single string like appending, manipulating the same one.
But here, what i am doing is extracting many small string from ONE main string, also passing this Main string to different method. and on these small strings i don't perform any operation and yes i am using regular expression for extracting peculiar strings
Any other help/comment on my this way would be appreciated.
Or any other light
regards
|
|
|
|
|
insert Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff")+": some text"); at several locations in your code, that will immediately tell you where most time is spent.
Regexes are anywhere from very slow to slow; optimize them, and/or throw them out and write proper search and replace code yourself.
Whatever you do, don't show us your code; someone might spot the problem at once.
|
|
|
|
|
Luc Pattyn wrote: Whatever you do, don't show us your code; someone might spot the problem at once.
Aah !! that i will never do
Well after putting up several DateTime.Now i found the real culprit, and to utter most surprise its not string function which i had wrote .
Its turns out to be display notification(as in Messengers there comes a pop up window at bottom right corner, not written by me ). Its consuming 2.5 sec out of 2.7 sec.
So, if you plz help me with this!!
Can we show this notification parallel, and move on to later execution.
not waiting until it ends up !!
How should i do this, any help/link would be appreciated.
But still curious, Is this approx .2 sec(subtracting time taken by notification) also slow??
your opinion?
regards.
modified on Tuesday, April 28, 2009 3:33 AM
|
|
|
|
|
Hum Dum wrote: pop up window ... consuming 2.5 sec
Then find or create a better popup. I trust it is not consuming 2.5 sec, instead the animation lasts that long, and nothing else happens in between because it isn't based on a timer nor a thread (so just a bunch of Thread.Sleep calls).
Hum Dum wrote: Is this approx .2 sec also slow??
Throw out the slow animation, look at the timestamps, and decide for yourself.
|
|
|
|
|
|
Hi,
I could write a book on software performance, it is a huge topic.
You haven't told hardly anything about your app, and haven't shown any code, so how could anyone judge its performance?
From experience, in 0.2 sec one can do any of the following:
- copy 100MB of data (RAM to RAM)
- read 10MB of disk data
- calculate 10 million prime numbers
does your program come close to any of those? if not, you probably are wasting time/cycles/...
guidelines:
- make it work correctly first (without using silly algorithms, silly coding); then optimize
- choose your algorithms carefully
- choose your data structures carefully
- don't use polling
- measure the results accurately
- consider and compare alternatives
- consider caching
- ... the list goes on
- as always, there occasionally may be a valid reason for not obeying some of the guidelines
Hum Dum wrote: so that no one can post my code here on coding horror forum
that is a dumb reason.
if there were a "stupid questions" forum, would you stop asking questions?
|
|
|
|
|
thanks for valuable time and guidelines, I will keep in mind.
Luc Pattyn wrote: if there were a "stupid questions" forum, would you stop asking questions?
Aah it seems like if there was no stupid then there were no clever ones.
After all both completes each other .
Hope you keep up well n be available here to answer other needy ones!!
regards,
Keep
|
|
|
|
|
hi
in my project i convert excel file in xml and then upload the file in data base . here i use SQL Server 2005. In my excel file consist one record D'Souza when such name comes program throw run time exception as Incorrect syntax near 'Souza
i use following query for insert a record
string istr = "insert into sheet1(Personnel_Area,EE_Grp,Employee_Group,ESgrp,Employee_Subgroup,Cost_ctr,Cos
t_Center,PSubarea,Personnel_Subarea,Peres_no,Personel_Number,Designation,D
esigna,Pos,Age_of_Employee,Birthdate,Complete_name)values('" + Convert.ToString(dataGridView1.Rows[i].Cells[0].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[1].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[2].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[3].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[4].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[5].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[6].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[7].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[8].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[9].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[10].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[11].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[12].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[13].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[14].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[17].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[18].Value.ToString()) + "')";
|
|
|
|
|
hi
in my project i convert excel file in xml and then upload the file in data base .
here i use SQL Server 2005. In my excel file consist one record D'Souza when such
name comes program throw run time exception as Incorrect syntax near 'Souza
i use following query for insert a record
string istr = "insert into sheet1(Personnel_Area,EE_Grp,Employee_Group,
ESgrp,Employee_Subgroup,Cost_ctr,Cos
t_Center,PSubarea,Personnel_Subarea,Peres_no,Personel_Number,
Designation,D
esigna,Pos,Age_of_Employee,Birthdate,Complete_name)values('" +
Convert.ToString(dataGridView1.Rows[i].Cells[0].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[1].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[2].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[3].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[4].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[5].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[6].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[7].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[8].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[9].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[10].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[11].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[12].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[13].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[14].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[17].Value.ToString()) + "','" +
Convert.ToString(dataGridView1.Rows[i].Cells[18].Value.ToString()) + "')";
|
|
|
|
|
What was wrong with this[^]? Please don't re post the questions.
Voted to remove message
|
|
|
|
|
do you have a question? or do you just want us to point out the bad things about what you have done?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
what ever i did it's work but when the word D'Souza comes it throws exception
when i delete the record D'Souza all the records (13,000 record) insert in to the table
so i am not point out my bad things.
i need some help or logic who elemenate such run time error.
|
|
|
|
|
ok, well you should check your other post about SQL Injection because using values directly from your table is causing the problem, the ' character in the name is what the sql query is not liking. What you need to do is use command parameters and insert your values that way.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Read and apply the answer that was given to your first post.
And NEVER use string concatenation to build queries in c#.
Edit: beaten by musefan
Edit2: I just remembered this xkcd comic[^]
modified on Monday, April 27, 2009 9:25 AM
|
|
|
|
|
I know that it is possible to run user-edit code within interpreted langauge such as Matlab, TCL and so on.
user can edit/add their own scripts to these interpreted language based application.
is it possible to do smilar things in c#?
to be clear, I want to do the following:
the user can give the values of array of x, y by programming, then they will be plotted by using one plot function.
sth like (simple example):
the user can edit the following code in a given richtextbox:
for (int i=0;i<100;i++)
{
x[i]=i*2;
y[i]=Math.Sin(x[i]);
}
then the application can know the x and y and then call one function plot_my(x,y).
is it possible to do so?
|
|
|
|
|
Yup, that's possible. Take a look at this article[^] for an example
I are troll
|
|
|
|
|
I m designing a utility to ping a range of IP addresses on C#,I know how to send ping to an IP address.The problem is that i am unable to design a loop with dotted decimal notation which will send pings to all machines between "FROM_IP_ADDRESS" to "TO_IP_ADDRESS". Help...
(what i m trying to do is to convert the address to long,but this doesn't help too.
|
|
|
|
|
For this to work, you can either break up the addresses into individual bytes with logical operators, or you can write your own code to jump from 255 to 0 and increment the next group.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Ya i had that in my mind...............
but i donno why i was reluctant to do that.... :
anyways.........thanx
|
|
|
|
|
Anyone can provide c# sample project? i need a complicated one for vsts 2008 unit testing.
Thanks for help!
|
|
|
|
|
Have you looked around this site at ALL ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Add whatever complexity you need to this
class Program
{
static void Main()
{
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I hope you started with a full requirements analysis for this.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
hello evryone,
i m trying to do one demo for improt excal into datagrid view using C#,.NET2005.
will you please send any demo related to this kind of thing.and code for it....
thanks in Advance
Naim Khan
|
|
|
|
|
I assume it's because you cannot spell that google is not working for you. Try 'import excel C# datagrid' instead of 'improt excal C# datagrid' and google will be more helpful.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|