|
Hi,
I have a requirement where in we are required to implement an “spell check” for the text we have entered for all Free Form and Text boxes within our ASP.Net application.
User should also get a way to "ignore" when spelling is correct similar to how Microsoft Word functions.
Please let me know if there is any component is available in .Net framework 3.5 or else pointer to the third party tool also be very much helpful.
Regards,
Palak Shah
modified on Thursday, November 26, 2009 7:04 AM
|
|
|
|
|
Google for HunSpell or NetSpell if you want something for free, or AspNetSpell or PolarSpellChecker if you want to buy one
They differ not only in features, but also in (the amount of translated-) dictionaries.
I are Troll
|
|
|
|
|
I was doing some performance testing to compare times for string == string and string.Compare() when I came up with some odd results. What I found was that after 10,000,000 iterations,
string.Compare("aBcDeFgHiJkLmNoPqRsTuVwXyZ", "abcdefghijklmnopqrstuvwxyz", true) == 0;
is almost 17 times faster than
string.Compare("aBcDeFgHiJkLmNoPqRsTuVwXyZ", "aBcDeFgHiJkLmNoPqRsTuVwXyZ", true) == 0;
Wha? I'm ignoring case! How can it take longer to compare identical string values versus ones that differ only in case? I checked out string.Compare() using Reflector though it makes a call out to unmanaged code.
|
|
|
|
|
The common way to do case insensitive compares is to convert both strings to all one case first. As in your first example, one string is already entirely lower case, nothing needs to be done to it. This will probably result in less work.
[Disclaimer: Pretty much just a guess]
[Edit: I repeated your experiment.
I found that method 1 took around 1.7 seconds and method 2 around 1.4 seconds for 10,000,000 iterations. This makes method 2 just 20% (1.2 times) faster. (No where near 17 times).
If you are finding a 17 fold increase (1700%!) I suspect you have some other problem causing an erroneous result. Also, remember that string literals can be handled very differently by the JIT compiler compared to string variables. If you really want to test the methods you should probably be using a list of randomly generated strings to prevent things like literal optimisation or caching effecting your results.
This was my code:
class Program
{
private static int iterations = 10000000;
private static int repeats = 10;
static void Main(string[] args)
{
long method1Total = 0;
long method2Total = 0;
for (int experiementCounter = 0; experiementCounter < repeats; experiementCounter++)
{
Stopwatch s1 = new Stopwatch();
s1.Start();
for (int iterationCounter = 0; iterationCounter < iterations; iterationCounter++)
{
bool result1 = string.Compare("aBcDeFgHiJkLmNoPqRsTuVwXyZ", "abcdefghijklmnopqrstuvwxyz", true) == 0;
}
s1.Stop();
Stopwatch s2 = new Stopwatch();
s2.Start();
for (int iterationCounter = 0; iterationCounter < iterations; iterationCounter++)
{
bool result2 = string.Compare("aBcDeFgHiJkLmNoPqRsTuVwXyZ", "aBcDeFgHiJkLmNoPqRsTuVwXyZ", true) == 0;
}
s2.Stop();
method1Total += s1.ElapsedMilliseconds;
method2Total += s2.ElapsedMilliseconds;
Console.WriteLine("Experiment {0} Method 1: {1} Method 2: {2}", experiementCounter+1, s1.ElapsedMilliseconds,s2.ElapsedMilliseconds);
}
Console.WriteLine();
Console.WriteLine("Averages: Method 1: {0} Method 2: {1}", method1Total / repeats, method2Total / repeats);
Console.ReadLine();
}
}
Simon
|
|
|
|
|
He must have meant 17%
((1.7-1.4)*100)/1.7 = 17.64 %
|
|
|
|
|
I wrote a lengthy post and decided to go over my code once more before hitting Post when I found a major flaw in my test. I accidently used Milliseconds off of the TimeSpan for each loop instead of TotalMilliseconds . The results were more as I had originally expected with the same case being faster.
As for using ToUpper() or ToLower(), though used more often, the execution is faster using string.Compare().
Thanks for the response!
|
|
|
|
|
string literals get interned, i.e. two identical string literals share the same memory and reference. string.Compare could easily contain a reference compare as a shortcut exit.
For all practical purposes, you should perform timing tests with variables, not literals.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Hi,
Very sorry to bother you with a basic question.
I don’t have the knowledge on .NET Design Patterns. Now I would like to go through them, understand and practice them.
Would you please let me know if there is any good book (using C#.NET as the language) which can be easily understandable on this .NET Design Patterns?
Many thanks.
Regards,
Reshma.
|
|
|
|
|
|
|
"Design Patterns in C#" by Christopher Lasater.
|
|
|
|
|
|
Try here
C# Design Patterns[^]
There is a commercial electronic book to go with this (I've not got it) but there are also free code snippets on this page.
A good more general book is Design Patterns Explained[^].
Code fragments are in Java, but it's very simple Java, and it does a very good job of explaining the concepts.
Kevin
|
|
|
|
|
|
Hi,
I am working on asp.net 3.5 in local environment, IIS 2.0 are installed on live server with win 2000 server as OS. so may i need to change server configuration, if yes, so what configuration we need to change for live server which will run asp.net 3.5 build sites?
Thanks in advance,
Abbas
|
|
|
|
|
As far as I know, the .NET 3.5 framework is not supported on
Windows 2000 Server.
.NET Framework System Requirements[^]
If you can't install the 3.5 framework on the server, then you may
need to target the .NET framework 2.0 (you can set this on the
Visual Studio project's property pages).
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark,
I also checked out that .NET 3.5 framework is not supported in win 2000 server, I already installed .NET 2.0 on it, so either we need to change our server configuration or we start our development work in .Net 2.0 framework.
Thanks,
Abbas
|
|
|
|
|
USING COMMAND BUTTON I AM OPENING A NEW FORM USING JAVASCRIPT AS FOLLOWS
"window.showModalDialog(urll, self , WinSettings)"
ONCE I CLOSED THAT FORM, AND AGAIN IF I CLICK THE COMMAND BUTTON THAT FORM IS NOT OPENING.
MEANS THE PAGE LOAD CODE IS EXECUTING ONLY FOR THE FIRST TIME.
HOW CAN I SOLVE THIS PROBLEM?
|
|
|
|
|
Please do not post multiple times. Your message has already been responded to here[^].
|
|
|
|
|
|
How can I retrieve data to a Label box using SQL Server
|
|
|
|
|
|
Very minor point: Note that the connection string might not be identical in terms of the # of \'s. At least using VB6 and C++ .NET the connection string might contain two \\ characters while VB6 using a single \.
|
|
|
|
|
Has anybody seen a full implementation for a date(time) class/struct in C#?
I don't need this for a project or anything (the built in one seems adequate for dealing with date and time constructs for business apps). However, I have a friend who is trying to pick up some of the more arcane OO concepts in C# and I thought such an example might give good coverage of operator overloading, serialization, etc. I had to do one way back in the day with C++, so I thought something similar might be a handy way of explaining the same concepts to him.
|
|
|
|
|
There is a very good example in Charles Petzold's publication .NET Book Zero[^].
|
|
|
|