|
Hi,
the regex approach is easy to write, however it is not very CPU-efficient; in my test it was between 8 and 9 times slower than the StringBuilder plus for-loop approach. And StringBuilder *is* the right approach when one has to perform a reasonable number of concatenations, since, without them, each operation would have to create a new string and copy its content (a quadratic cost).
When more complex character collections have to be removed, isAlpha is not useful anymore, IndexOf could be the right approach; it would slow down the for-loop by a factor of 2, however the regex also slows down when adding to the search set.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
I din't vote you down, but the first line of your answer I didn't like.
"Forget regex" sounds like you were saying regex was not the right choice - in actual fact it is certainly something you should consider for this sort of task. But I think you know that and the "forget regex" was a flippant remark.
Anyway, it was a good enough answer.
|
|
|
|
|
your right... I meant no offence to Regex or it's users
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi,
Any idea how to capture a router's amount of data transferred (Sent/Received)?? You know, you're browsing the internet and want to know how many bytes you've used so far since morning for example..
Thank you.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
You could try UPnP..
Or just use Networx[^] if you just want to know the number and don't mind not having programmed it yourself
|
|
|
|
|
|
I use NetMeter[^] which gives daily, weekly, monthly and complete totals (for your PC, not the router which may be shared). Freeware, works fine.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi.
I have created a file with ".abc" extension..
double clicking on that file im opening mdi application and displaying the data in child window.
if i double click on another file it is not opening in new mdi child.
please help me how to proceed to open new child window in an mdi app on double clicking the file..
thanks
|
|
|
|
|
how to make application forms lookable? pls help
|
|
|
|
|
|
harold aptroot wrote: What does that mean?
The correct answer: LIQUID NITROGEN[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
one way is to use AjaxControlToolkit (in web application)
modified on Thursday, June 25, 2009 8:20 AM
|
|
|
|
|
How do you get this answer from the question posted? Do you have some form of mind-reading skills?
|
|
|
|
|
Serv-dee wrote: how to make application forms lookable?
Switch the monitor on. If it's off, it's not lookable.
"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
|
|
|
|
|
Just adding to Pete's reply,
If the monitor is on, the eyes must be kept open too. Having the monitor on and the eyes closed will still make the forms not lookable! Additionally, the monitor must be installed on the correct direction (the display panel facing the user). Also, any number of reasonably large and opaque objects in between the eyes and the monitor can make the forms not lookable.
This looks like one of those 'tough' questions to me.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I don't think serv-dee likes being mocked. What a shame because I've got a whole lot of mocking that I have to get in before years end, and I'm behind schedule.
"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
|
|
|
|
|
I think that with the little information available in the query, the answers given were pretty reasonable and logical. If we are being disliked for that, we cannot help it.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi All ,
I would like to to have my two variables date1 and date2 to return the following format in Asp.net.
Date1=20090625124000 and date2=20090625133900
Date1 and date2 have a diffrence on one hour in between.
How can i build date1 and date2
Thank you in advance.
|
|
|
|
|
DateTime date1 = new DateTime(2009, 6, 25, 12, 40, 0);
DateTime date2 = new DateTime(2009, 6, 25, 13, 39, 0);
string date1Str = date1.ToString("yyyyMMddHHmmss");
string date2Str = date2.ToString("yyyyMMddHHmmss");
|
|
|
|
|
string _date1 = DateTime.Now.ToString("yyyyMMddHHmmss");
DateTime _dateNew = new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day,
DateTime.Now.Hour - 1,
DateTime.Now.Minute - 1,
DateTime.Now.Second);
string _date2 = _dateNew.ToString("yyyyMMddHHmmss");
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi,
How i can integrates my application with the active directory and autenticate the user & pass.
Thanks
|
|
|
|
|
|
Hi!
In a simple game I'm creating, I need to trigger some methods when one of the arrow keys are pressed as well as the space key.
I'm using this code in the form to receive the keyboard inputs:
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
if (e.KeyCode == Keys.Up && e.KeyCode == Keys.Space)
MessageBox.Show("UP & SPACE");
}
Nothing happens when I run the code. The OnKeyDown event don't seem to handle this condition at all.
How shall I solve this problem?
|
|
|
|
|
If you look at the documentation, (or even just try it and look at what you get) I think you will see that you get a OnKeyDown event for each key. No, not together. Seperately. One after the other.
Just how did you think e.KeyCode was going to equal two different values? Rewrite your code as
if (e.KeyCode == 1 && e.KeyCode == 2)
and you might get the point?
I am posting this to Coding horrors as a warning to all other students.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Really good answer, thanks Even if you didn't offer any solution
I have never thought that e.KeyCode never could return two or more keyboard inputs
|
|
|
|