|
mav.northwind wrote: Why does the article you link to make you think you can read passwords from AD? I couldn't find a single line where something similar is mentioned.
here's eight lines:
<br />
public static DirectoryEntry GetDirectoryEntry()<br />
{<br />
DirectoryEntry de = new DirectoryEntry();<br />
de.Path = LDAP:
de.Username = @"yourdomain\sampleuser";<br />
de.Password = "samplepassword";<br />
return de;<br />
}<br />
Norman Fung
|
|
|
|
|
Let's clarify the difference between read and write:
- read: You retrieve the (yet unknown) value of the password from a source that can give you this password. AD can not.
- write: You set the value of de.Password to a known value ("samplepassword").
mav
|
|
|
|
|
Like I said, didn't have time to try out the code (repeat: "I did not try the code"). I do understand setters/getters, thanks for the patience. Basically, I was asking "You cannot read that attribute?" or "Is there another class in this/other object library from which I could perhaps read from it Hash of the password at least? or there's no way you can read passwords from AD?"
|
|
|
|
|
Hi folks,
I am kind of confused about C# def. about shallow copy. As far as I know, shallow copy points to the same memory location as the orginal, so if we make some changes to the copy, the orginal will be changed.
I did a test by doing the followings:
ArrayList a=new ArrayList();
a.Add(1);
a.Add(2);
ArrayList b=(ArrayList)a.Clone() /*C# says it will create a shallow copy here */
b.Add(3);
Now a and b are difference, I am confused here.
What am I misunderstading? And how to create a true deep and shallow copy in C#?
Thanks.
|
|
|
|
|
First, you need to understand the difference between value types and reference types.
All structures and primitives (such as int, long, float) are value types. Value types exist in the stack and are always copied. For example:
int a = 1;
int b = a;
All classes are reference types and their objects exist in the heap. Variables used to access class objects really only store addresses (so to speak) to their objects. Keyword "new" creates an object and returns a reference to that object. For example:
ArrayList a = new ArrayList();
ArrayList b = a;
Now, a shallow copy means that only an object's member variables are copied. This means the value types and references are copied, but the referenced objects themselves are not copied/cloned. A deep copy is when you clone the referenced objects too. You can do this by overriding your class' Clone() method and explicitly clone your reference member variables.
In the case of your ArrayList example, it's storing integers which are value types. So, changing the cloned ArrayList's items will not effect the original ArrayList. However, if the original ArrayList stored reference types instead, then that would be another story.
Phew! That was a bit long winded, but I hope that made sense.
|
|
|
|
|
the example you shown is shallow copy.
To achieved deep copy you need to create an object for arraylist and not a reference to it
ArrayList b = new ArrayList().
int i = 0
while (i < b.count)
{
a[i] = b[i];
i++;
}
shallow copy mean two pointers pointing at the same piece of memory.
|
|
|
|
|
hello. i have a menu, when a user clicks an item in it, the program calls a function, which calls another function based on the value of a combobox. the combobox isnt visible until the first function is called, how can i make the program 'wait' until an item is selected in the combobox? i try this, but it returns 1 right away.
while(clientlist.SelectedText == "Choose Client #")
continue;
clientlist.Visible = false;
return (System.Convert.ToInt32(clientlist.SelectedItem) + 1);
any suggestions?
thanks in advance,
sam kline
|
|
|
|
|
Correct me if wrong ;(
below is my idea....
1. set the combobox to be invisible
2. in the first func: set the combo box to be visible
3. In the event handler for the combo box, call the second func when user selects the item from the combo box
<< >>
|
|
|
|
|
HI,
Why don't you use selected item change event of the menu to show the combobox and execute the combobox selected Index change function.
regards
|
|
|
|
|
I'm trying to write a wrapper for this mfc dll to call from c# via p/invoke
Code128BarcodeToClipboard
[^]
I get the win32 error code 203: The system could not find the environment option that was entered.
Has anyone had any luck calling these methods from c#? I need to generate the barcode images(code 128) from an aspx page...any help would be appreciated.
Thanks
Graham
Graham
|
|
|
|
|
I thought there was C# code to generate bar codes on CP somewhere ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
There is...but unfortunately they aren't the type I require...i've found codabar and several others in c# but only an mfc version for the code 128.
I created an active x control wrapper for the mfc dll, but get a COMException "catastrophic error" when i try to invoke a function from c#.
I'm experienced in writing and calling native win32 dll's...but having a lot of trouble trying to use the MFC component. I can get the code to run from adding the method to the contstructor, but can't pass any parameters that way, and still get the error when i try to call a function.
I used aximp.exe to generate a slightly different interface to the component, but still get an ActiveXException when I try to invoke a member.
Graham
|
|
|
|
|
I am getting a id from a datagrid in a aspx page and then I want another page to display de pdf file file corresponding to the id, with the path in a sql2000 file. Can anyone help me.
|
|
|
|
|
Hi there,
Just open a window with the url pointing to the pdf file on ur web server, and you dont have to worry anything becoz IE will do it for u.
<< >>
|
|
|
|
|
I'm writting an app that receives and sends a data packet via TCP/IP
I'm wondering what would be the easiest way to parse out the data packet I receive, since there are no delimiters seperating the information.
Here is the break down of the data packet
four-byte start pattern
two-byte binary
20-byte fixed length
variable length data
four-byte end pattern
Thanks for your thoughts
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
It appears to me that you answered your own question.
You know that the first 4 bytes are the start pattern
You know that the next 2 bytes are binary
So on and so forth,
.....
|
|
|
|
|
okay so maybe I'm over thinking this, but I can do something like
coutn over 6 (total bytes) to the data that I'm looking for.
I guess I'm wondering is how do I tell my app to go to this spot in the data stream, and grab the data from here to there and copy it to the string variable?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
|
How can i add a new string to the array?
I've never actually used an array before , yes i know, incredible isn't it.
|
|
|
|
|
Hi there,
Just create a new array with it's length is increased one. Then, copy all the values from names array to the new one and add a new string to the new one.
For me, it's easier if using ArrayList object.
<< >>
|
|
|
|
|
Don't use array any longer.
You should use System.Collections.ArrayList instead or in .NET 2.0 generics: List<Type>.
André
'A programmer ist just a tool which converts caffeine into code'
|
|
|
|
|
I have an old C++ thread unsafe library that I must use for a new multithreaded C# project. I was hoping that I could use AppDomains to load mulitple instances of the library so that I could use multiple threads yet keep segregate the data. This seems to work for managed code, but not for old unmanaged libraries. Can anyone explain why? Does anyone have suggestions on other ways to use the library in a multithreaded environment?
|
|
|
|
|
I'm sure this is a common question but my choice of search criteria isnt yielding me an answer....
I have a class like this:
[Serializable]
public class MyClass
{
public string Name
{
public string HiddenName
{
}
If I attempt to serialize that class both the Name and HiddenName field get serialized. I dont want to serialize HiddenName . So how can I do that?
I have tried adding the [NonSerialized] attribute to HiddenName but that doesnt compile.
Thanks for the help
|
|
|
|
|
If you are referring to xmlserialzation then according to the MSDN:
Preventing Serialization with the XmlIgnoreAttribute
There might be situations when a public property or field does not need to be serialized. For example, a field or property could be used to contain metadata. In such cases, apply the XmlIgnoreAttribute to the field or property and the XmlSerializer will skip over it.
Other wise try this from the MSDN:
A class often contains fields that should not be serialized. For example, assume a class stores a thread ID in a member variable. When the class is deserialized, the thread stored the ID for when the class was serialized might no longer be running; so serializing this value does not make sense. You can prevent member variables from being serialized by marking them with the NonSerialized attribute as follows.
[Serializable]<br />
public class MyObject <br />
{<br />
public int n1;<br />
[NonSerialized] public int n2;<br />
public String str;<br />
} If possible, make an object that could contain security-sensitive data nonserializable. If the object must be serialized, apply the NonSerialized attribute to specific fields that store sensitive data. If you do not exclude these fields from serialization, be aware that the data they store will be exposed to any code that has permission to serialize. For more information about writing secure serialization code, see Security and Serialization.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
But you cannot apply [NonSerialized] to properties only fields. I can change the code to use a field rather than a property but that doesnt seem right either.
|
|
|
|