|
Hi,
I have written some custom rules for FxCop. Now i want to make sure that developers will be able to CHECK IN the code only if they follow the rules. If any one of you have come across this scenario, please help.
I am using VSTS 2005 and FxCop 1.35.
Where did error begin?
-- Naison Garvasis Pekkattil
|
|
|
|
|
|
Hi Vasudevan,
Thanks
Where did error begin?
-- Naison Garvasis Pekkattil
|
|
|
|
|
Hi!
All
I am new to this site..
I am in a situation where i want to change the owner of the file (*.txt,or any other) (local / remote)file.
I have successfullly written code to change the file's last modified date and time and as well as created time and date.
But I want to chanage the owner too.....
I unable to do this magic....
can anybody help me to come out of this....?
After Searching around 6 hrs (including this Codeproject) on Internet , I am finally posting here....
Thanks in Advance...
D.N.Raj
|
|
|
|
|
How does a file have an owner ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes ! File is having attribue of 'oWner'
We can see all the attributes in windows explorer by selecting from view->Details and right click below the address bar we can see the file size, type, owner, author, title, comments...etc..
Thanks
|
|
|
|
|
what is the use of PDB files on dotnet. i am developing a profiling application
shall i use the pdb file to point the exact code?
My small attempt...
|
|
|
|
|
|
Hello,
I have a datatable. I pass this datatable to a method and made some modifications to it. Once I do accpet changes the original datatable also get changed.
code is as below:
datatable dtUser;
dtUser = session["userdetails"]
obj.MakeChange(dtUser)
public void MakeChange(Datatable dt)
{
dt.Columns.Remove("Name");
dt.Columns.Remove("card");
dt.Acceptchanges()
}
Once the program executes dt.Acceptchanges()the original datatable also get changed : dtUser
I do not want this to happen. What can be done to this please suggest.
Regards,
Pavas
|
|
|
|
|
A datatable is not a value type, so it's always passed by reference. Use the Clone method to make a copy and pass that,in order to avoid this behaviour, or clone it inside your method.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Chrstian
Regards,
Pavas
|
|
|
|
|
Please help me out for the following code
class myTreeView: TreeView
{
protected override void OnBeforeExpand(TreeViewCancelEventArgs e)
{
// doing some code childs nodes from the selected node
}
}//end class
// in the man form fro where i useing myTreeView
class MainForm
{
myTreeView my =new myTreeView();
// ok here the myTreeView it call the OnBeforeExpand events
//I want to use the code generated in the OnBeforExpand event to use in this class
}
Is there any method to get the information that get the event in the myTreeView class and in the Event OnBeforeExpand.
Can anybody tell me how can i sore the data when the OnBeforExpand evnet is call an i can use in MainForm
I am not getting the sequece of how to work on it.
|
|
|
|
|
Naveed khan nido wrote: Is there any method to get the information that get the event in the myTreeView class and in the Event OnBeforeExpand.
What do you mean ?
Naveed khan nido wrote: Can anybody tell me how can i sore the data when the OnBeforExpand evnet is call an i can use in MainForm
By handling the event and writing code to sort the elements inside that event handler ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Fist of all thanks for reply
If you read my Question carefully in it i want to use a class in this class only on Event is implemented that the event do some work i want to add some work in class to save the information when the event is fired.
The problem is that when the event is fired how the Main class can know that the event of child class(the class that i am using in main class) is fired. Is there any technique that the main class put watch on the child class when the event is fired i got it. And retrieve the information that have done in the child class.
You can understand in other criteria
For example if the event have return type then it can solve my problem. But there is not then how can i do this Programmatically .
|
|
|
|
|
Naveed khan nido wrote: Is there any technique that the main class put watch on the child class when the event is fired i got it. And retrieve the information that have done in the child class.
You'd have to impliment an event in the child class that the main class can subscribe to. So, catch your event and throw your own event
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
But i cannot do this plz provide me a link in which the same situation is occur to which i can get help.
or just few line example.
|
|
|
|
|
It's very, very easy. Your explanation left me unsure exactly what you want, but if your class derives from the parent, just override the method that sends the event. Your class is sending the event, not recieving it. So, override the method, do your own work but make sure you call the base method so the event is still sent.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello everyone,
Here is my code for review to see whether it is thread-safety. My question is, after remove the object instance from List buffer, I exit the lock synchronization block in method RemoveAndUseItem, is it thread safe to exit the lock synchronization and call method RemoveAndUseItem (method RemoveAndUseItem will only touch the removed instance)?
List<Foo> Buffer;
object ListLock = new object();
void AddItem(Foo f)
{
lock (ListLock)
{
Buffer.Add(f);
}
}
void RemoveAndUseItem()
{
Foo LastItem;
lock (ListLock)
{
LastItem = Buffer[Buffer.Count - 1];
Buffer.RemoveAt(Buffer.Count - 1);
}
SafeUseItem(LastItem);
return;
}
void SafeUseItem(Foo f)
{
}
thanks in advance,
George
|
|
|
|
|
You need to understand why you are locking the list first - that's because the List class does not support concurrent addition/removal/access of elements. What would you gain by locking manipulation of the Foo instance? No other thread can add or remove or access the list, while you are manipulating a totally unrelated object.
Would you want that? No, so that's the answer - you don't need to call SafeUseItem from within the lock, as long as you don't reference the list from that method.
|
|
|
|
|
Thanks Senthil,
1.
S. Senthil Kumar wrote: No other thread can add or remove or access the list, while you are manipulating a totally unrelated object.
In my scenario, I have no such requirement. But are there any samples, which we need to lock the whole List even we removed the instance?
2.
S. Senthil Kumar wrote: Would you want that? No, so that's the answer - you don't need to call SafeUseItem from within the lock, as long as you don't reference the list from that method.
So, you mean if I removed the reference from the list (List.RemoveAt), there is no need to lock the reference any more?
regards,
George
|
|
|
|
|
AFAIK, your code is not thread safe. The object you used for locking is not a static member. So each thread will have it's own ListLock instance which should not happen.
George_George wrote: // no lock here? safe?
SafeUseItem(LastItem);
As senthil said, until you are not using Buffer in SafeUseItem() method, you don't need lock.
|
|
|
|
|
Sorry, N a v a n e e t h!
It is my coding bad. I should use static member since there is only one instance of class.
regards,
George
|
|
|
|
|
N a v a n e e t h wrote: The object you used for locking is not a static member. So each thread will have it's own ListLock instance which should not happen.
How did you come to that conclusion? After all, he could be sharing a single instance of the object across multiple threads.
|
|
|
|
|
S. Senthil Kumar wrote: he could be sharing a single instance of the object across multiple threads.
Yes, possible. But he hasn't mentioned that. So I thought so.
|
|
|
|
|
hi all experts,
as i'm new to this, can someone plz advice me?
my project requirements:
1. images upload with adding texts/descriptions attached to it (save it in notepad/html??) using microformats (not too sure also as need details from lecturer)
2. search images via information in the notepad/html saved to the images
3. display searched results images
should i use C#, VB, C++ for this project? as i want to start on the right path... can someone plz refer to any guide?
i've found this:
http://www.codeproject.com/KB/aspnet/netimageupload.aspx
is this the right on to start on? so i can add on later...
please help thanks a million.. waiting on your reply!!
my email/MSN : narmon@gmail.com
plz help
|
|
|
|