2007
09.25
Search for this at Google:
Invest $1000000 for Movie
And compare the result from Yahoo:
Invest $1000000 for Movie
Surprisingly, my blog is no.2 at Yahoo’s result, but nowhere in Google’s result. I did even try to search within result in Google by adding word ‘Sodeve’, but nada, zilch, nil .. nothing.
I know.. I know.. I should be grateful to Yahoo for putting me in the 2nd spot .. but for the sake of fairness to the poor soul who is trying to get an investor to invest $1 Million in his/her movie project, please use Google next time
As for Yahoo, this means that there are a lot of rooms for improvements in its searching algorithms
(in case the result changed, I put the screenshot HERE)
2007
09.25
I notice from my traffic log that there was someone bumping to this blog searching for ‘C# Regex Word Count’. Since I never create such tutorial, so here you go.
The basic rule of a word would be it doesn’t contain any whitespaces (spaces, tabs, or newlines). So the easiest Regex would be:
[^\ ^\t^\n]+
Now to implement it using C#, It would be as follows:
public int WordCount(String input)
{
int result = 0;
try
{
Regex rgx = new Regex(@"[^\\ ^\\t^\\n]+");
MatchCollection mcMatches = rgx.Matches(input);
result = mcMatches.Count;
}
catch (Exception ex)
{
}
return result;
}
An improvement would be putting the Regex creation out of the function, this way we will not re-created the Regex everytime the function is called.