|
Hi,
I have created a website in C#, Asp.Net on .Net framework 2.0, I want to track (number of hits) for referral URL(as www.mysite/goto/dom) which redirect me to actual URL(www.mysite/abc/default.aspx?client=dom) I am able to track actual URL by Google Analytic code but having no control on referral URL(but I want to track them, Please help me regarding this issue or forward me any article) Thanks.
|
|
|
|
|
|
Hi there
First excuse me for my bad english text
I am new in c# and i have a phonebook project.I want to control input name.
For example just [a-z] and space can type in textbox.
i think regular expression is good class for this but i dont know how do it.
can anyone help me? pleas give me a complite answer.
Thank u very very much for your help
|
|
|
|
|
I would implement that in the KeyPress event handler instead.
|
|
|
|
|
Thanks for your response
|
|
|
|
|
the following code should work and will return a bool for you...
System.Text.RegularExpressions.Regex.IsMatch(textbox1.Text, "^[A-Za-z ]*$");
Life goes very fast. Tomorrow, today is already yesterday.
modified on Wednesday, September 2, 2009 11:17 AM
|
|
|
|
|
Dear musefan
Thank u for your help. That help me
|
|
|
|
|
Okay. So my first attempt in sorting the strings using Radix Sort is a failure(The one with converting all strings into ASCII code).
Now, what i want to do is use the strings directly to sort them out using Radix Sort. Is there any available source code that can sort strings using Radix Sort? I already got one source code but I think it's implemented in Java. I don't have any time to make my own code since it will be passed on saturday(GMT +8:00).
One question though. What programming language that uses CharAt() method? Is that Java? If so, what is the equivalent method of that in C#?
|
|
|
|
|
gamer1127 wrote: What programming language that uses CharAt() method?
It could be an Extension Method.
gamer1127 wrote: what is the equivalent method of that in C#?
Just use an index: c = s [ i ]
|
|
|
|
|
gamer1127 wrote: CharAt() method? Is that Java?
Yes.
In C#, you can index a string as if it were an array. The elements are of type char , and of course read-only.
|
|
|
|
|
This is the source code that I got. It's a msd Radix sort:
public static void msd(String[] a)
{
msd(a, 0, a.Length, 0);
}
private static void msd(String[] a, int l, int r, int d)
{
int N = a.Length;
if (r <== l + 1) return;
int[] count = new int[256];
for (int i = 0; i < N; i++)
count[a[i].charAt(d) + 1]++;
for (int k = 1; k < 256; k++)
count[k] += count[k-1];
for (int i = 0; i < N; i++)
temp[count[a[i].charAt(d)]++] = a[i];
for (int i = 0; i < N; i++)
a[i] = temp[i];
for (int i = 1; i < 255; i++)
msd(a, l + count[i], l + count[i+1], d+1);
}
How will I revise this so I can use it in c#?
|
|
|
|
|
count[a[i].charAt(d) + 1] -> count[a[i][d] + 1]
|
|
|
|
|
I'm still having a problem with my string sorting. I always get the IndexOutOfRange exception during runtime.
How will I solve that?
public static void SortByLastName(ref string[] arrayOfLastNames, ref string[] arrayOfFirstNames, ref string[] arrayOfPlateNum, ref string[] arrayOfType, ref string[] arrayOfYear)
{
Console.Clear();
int vehicleCountInt = 0;
Console.WriteLine("SHOW DATABASE: SORTING BY LAST NAME\n");
using (StreamReader countVehicle = new StreamReader("vehiclecount.txt"))
{
vehicleCountInt = Int32.Parse(countVehicle.ReadLine());
}
using (StreamReader outputLastNames = new StreamReader("lastnames.txt"))
{
int[] b = new int[vehicleCountInt + 1]; ;
for (int i = 0; i < vehicleCountInt; i++)
{
arrayOfLastNames[i] = outputLastNames.ReadLine();
Console.WriteLine();
}
}
int N = arrayOfLastNames.Length;
int W = arrayOfLastNames[0].Length;
string[] temp = new string[vehicleCountInt];
for (int d = W - 1; d >= 0; d--)
{
int[] count = new int[vehicleCountInt];
for (int i = 0; i < N; i++)
{
count[arrayOfLastNames[i][d] + 1]++;
}
for (int k = 1; k < 256; k++)
{
count[k] += count[k - 1];
}
for (int i = 0; i < N; i++)
{
temp[count[arrayOfLastNames[i][d]]++] = arrayOfLastNames[i];
}
for (int i = 0; i < N; i++)
{
arrayOfLastNames[i] = temp[i];
Console.WriteLine("{0}", arrayOfLastNames[i]);
}
}
}
|
|
|
|
|
You don't need ref for those arrays, you're not assigning to them
But wait, how can you be sure that those arrays are long enough?
tip: always tell where you get the exception.
I suspect it happens here: arrayOfLastNames[i] = outputLastNames.ReadLine();
Since there is no guarantee that arrayOfLastNames is long enough (its length is unknown)
|
|
|
|
|
Ok..Is there a way on how to solve that problem? I'm thinking of declaring an array that is large enough for me to store those names.
|
|
|
|
|
I hope you aren't asking for a way to declare an array of a given size..
int[] b = new int[vehicleCountInt + 1]; is one such declaration, but probably 1 too big (why are you adding one?)
If you are asking how to assign to an array which is a function parameter, well, ref is used for exactly that purpose, but out may be sufficient. But this "problem" is as trivial as the first.
|
|
|
|
|
Well I'm referring to how will I solve the problem about the uncertainty of the array's size. I've declared 5 text files with 30 data inside. Now what my groupmate did was create a text file and put there the total number of data inside the text files, and that's the vehicleCount .
Now what I'm thinking is declare an array that has a definite size (say 50) which will hold the data inside the text file(the 30 predefined data and the user's additional inputs). Will this solve the problem about the IndexOutOfRange exception?
|
|
|
|
|
Declaring an array to be intentionally too big is not really nice
You could make it a List or read the file all at once and then split on newlines
|
|
|
|
|
Your right...It didn't solve the problem..I'm sticking to the original code that we created (having a text file that acts like a counter).
|
|
|
|
|
|
string strRaw = "Thisisastring";
char[] astrSorted = strRaw.ToCharArray().ToArray();
Array.Sort(astrSorted);
string strSorted = String.Empty;
foreach (char strChar in astrSorted)
{
strSorted += strChar;
}
eto try mo dn tong code nato
|
|
|
|
|
How to enable click event in Grid view, I am using class Libray project plase help.
modified on Wednesday, September 2, 2009 8:54 AM
|
|
|
|
|
Display the Properties tab in VS when focus is on the GridView, and click the Events button. Scroll to the 'Click' event and select the appropriate event; the designer will create stub code and navigate to the function so you can add your code.
|
|
|
|
|
hi,
how can i develop a patch for my win application. whenever i update some portion in my apps and then i have to always give the big setup to my client. it is very time consuming. so anyone can tell me how can i develop a patch for my apps that when i update any portion of apps then i will just create a path and give this path to my client and client will install easily. if is there any way then please tell me how can i do it.
tbhattacharjee
|
|
|
|
|
You can buy tools to do this, which actually do patch the binary.
You can also use winzip self extractor to deploy just the files needed to update an install.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|