|
ArneKruger wrote: My question is: how do you tackle such thing?
Regex.Escape()
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Thanks!
I think I finally got the thing working. The problem with RegEx.Escape was that the dos-style wildcards (*, ?, #) were also escaped by the RegEx.Escape(..) method. I had to perform some preparsing.
|
|
|
|
|
I have always used the Tag property eg when loading a listview I put the row ID into the tag property and use it to locate the row in a table when any processing is done. The same with the treeview, stick the ID into the nodes tag property.
Recently I have seen samples where the object is put into the tag property eg. the datarow instead of the ID value. Certainly makes management easier, I no longer have to go looking for the datarow.
Question is, are there any drawbacks to using the Tag property in this way.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I don't think so. I always used to keep custom class objects in the tag property and worked well so far. Only problem I felt is casting. Each time you have to cast it back from object.
|
|
|
|
|
Casting has still got to be easier than hunting down a record in a dataview ot table.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Question is, are there any drawbacks to using the Tag property in this way.
Yup. Memory consumption. You have a play off here between convenience for the developer and possibly a slowdown of the system due to you having to retrieve data based on the tag. The more data you have stored, the greater the memory consumption.
|
|
|
|
|
However if I'm retaining the table as a form variable (often the case) there should be no additional cost.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Usually Tag is used to keep objects which are already created like DataRow or a ListView item. So it is keeping a reference to the actual object. Hence, memory consumption won't be an issue I think.
|
|
|
|
|
N a v a n e e t h wrote: Usually Tag is used to keep objects which are already created like DataRow or a ListView item.
That assumes that you're keeping them, rather than letting them die off and storing the id in the tag field.
|
|
|
|
|
Pete O'Hanlon wrote: rather than letting them die off and storing the id in the tag field.
That objects are part of the control. So we can't let it die. We keep a reference to those object in tag. Real object data will be removed when application ends or the associated control disposes.
|
|
|
|
|
Hello everyone,
I am accessing a web site using Windows Integrated authentication. I and the web server are in the same domain using IIS 6.0. Server runs on Windows Server 2003 and the client runs on Windows Vista.
When using the following code segment, there is always 401 error and exception. But when I am using the System.Net.CredentialCache.DefaultCredentials, the code runs successfully. Any ideas what is wrong?
try
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://TestWeb/Monitor");
NetworkCredential myCred = new NetworkCredential("domain\\user", "mypass");
CredentialCache myCredentialCache = new CredentialCache();
myCredentialCache.Add(new Uri("http://TestWeb/Monitor"), "NTLM", myCred);
req.Credentials = myCredentialCache;
req.ContentType = "text/xml";
req.Method = "GET";
req.Accept = "text/xml";
WebResponse resp = req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
Console.Write(sr.ReadToEnd());
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
thanks in advance,
George
|
|
|
|
|
George_George wrote: NetworkCredential myCred = new NetworkCredential("domain\\user", "mypass");
Try the constructor taking 3 arguments. Seems it might mess up on the domain part.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Thanks leppie,
I have tried when specifying the 3rd parameter domain, it works. But when keep the 3rd parameter to be null, it does not work. My confusion is, I think the two approaches are the same
- keep user name as Testdomain/George, and domain value to be null;
- specifying the user name George and domain to be Testdomain separately.
Just like when we log into Windows, we can enter Testdomain/George to be user name and we can also specify domain and user name separately.
Any comments?
regards,
George
|
|
|
|
|
George_George wrote: My confusion is, I think the two approaches are the same
Looking at the code via Reflector shows you, it is in fact not the same. Why it is like that, I have no idea
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Thanks leppie,
Which methods in Reflector are you comparing to and see whether they are of the same or different? I have the Reflector at hand and want to have the same page with you.
regards,
George
|
|
|
|
|
George_George wrote: Which methods in Reflector are you comparing to and see whether they are of the same or different? I have the Reflector at hand and want to have the same page with you.
I am looking at:
public NetworkCredential(string userName, string password)
: this(userName, password, string.Empty)
{
} Note the 3rd parameter is an empty string, and not the domain. Drilling into the called constructor, you will see no such seperation of username/domainname is taking place.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Thanks leppie,
I have got your points.
regards,
George
|
|
|
|
|
can someone give me a source code as to create pin code changing in atm application that use of c#????
|
|
|
|
|
You forgot to say that it's urgent and to leave your e-mail address.
|
|
|
|
|
ok. it's urgent to me and here is my email... qbert_mi2@yahoo.com
|
|
|
|
|
OMG
|
|
|
|
|
How did you guess what I was thinking?
|
|
|
|
|
Now what are you going to do with his leg now that it came off in your hand - that has got to be one of the dumbest responses I've seen for some time. I think Chris needs to add a SARCASM icon.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I'm going to send him code. That's why I asked!
|
|
|
|
|
I can't believe you're getting such rude responses to your perfectly reasonable and meaningful question. I've taken some time and wrote up the source code for you. Here it is:
pin = newPin;
There you go. I hope it solves your problem. Remember the semicolon at the end.
|
|
|
|