|
Hi, very simple question:
WindowsPrincipal principal = (WindowsPrincipal) Thread.CurrentPrincipal;
bool bIsInRole = principal.IsInRole(WindowsBuiltInRole.Administrator);
What if the role is a user defined role? (ie. not built in)
Thanks.
norm
|
|
|
|
|
How about:
bool isDishWasher = principal.IsInRole("DishWasher");
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
Thanks. I got it working now =)
norm
|
|
|
|
|
This may sound stupid ...
Could someone explain the difference between OleDB and ADO? I mean I can use both to access a database so what is the point of having both available ?
Am I right in this?
Cheers
John
|
|
|
|
|
Yes, you are right, you can use both.
ADO is a layer over OLEDB. ADO is easier to use, is fast and it's "universal", meaning that code using ADO (and well written queries) can usually be database independent. ADO achieves this through a lowest common denominator implementation and feature querying. So, most high-level code uses ADO.
OTOH, OLEDB can be used both as a database commnunication driver for ADO and as a substitute for ADO. If you want to use some specific DB features (e.g., some BLOB specific features on Oracle), OLEDB is the way to go. It is slightly faster than ADO (my own biased benchmarks showed less than 5% difference, but YMMV).
But this is a weird question on a C# forum
Help me dominate the world - click this link and my army will grow
|
|
|
|
|
Hi!
I need to use configuration file with subSections.
<Section>
<SubSection>
<Parameter>
<Parameter>
<Parameter>
</SubSection>
</Section>
I use Configuration Application Management Block (CMAB)
that does not support SectionGroup or something like that.
May be someone knows how can I manage this.
Thank you!
|
|
|
|
|
I should make application that RIP , Play and convert audio and video files in .NET but I can not find any library(components) about it.I found ActiveX controls ,but I prefer to use .NET components.If anybody know some link or answer about that.....
|
|
|
|
|
How can I add double qoute(") in my string?
Mazy
No sig. available now.
|
|
|
|
|
Escape the double quote:
s = "this \" is a double quote";
or
s = @"this "" is a double quote";
|
|
|
|
|
Thanks Corinna.
Mazy
No sig. available now.
|
|
|
|
|
\" perhaps?
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Yes.
Mazy
No sig. available now.
|
|
|
|
|
|
I saw a lot of datagrid messages but still remain a few questions for me:
1. there is a simple way to know if the grid was edited or not (= any cell changed, deleted, added or not)
2. I want a grid that is not readonly but allows just update or update and delete but no insert, ...
3. want to scroll down: when the grid is show the last lines be visible
4. a kind of alternate color: change rows background upon a cell value (have more records for a day and I want to have rows for same day in same color, changing background for the next day)
Thanks
|
|
|
|
|
Anyone have any experience with used the FileSystemWatcher in conjunction with FTP?
Trying to processing incoming files at are being dropped into a given directory via FTP, but don't want to start processing until the FTP process has *completed* writing the file to disk.
Any ideas? The NotifyFilters don't seem to allow for the "close" on the file.
TIA.
~Mike Stanbrook
|
|
|
|
|
Ok, I've gotten around the problem by attempting to open exclusively, and sleep until successful.
However, for large files, I still get 3+ "Changed" events thrown.. anyone have a good scheme for blocking/ignoring the extraneous events ?
TIA.
~Mike Stanbrook
|
|
|
|
|
Hello all. I'm trying to do some tag swapping and having no success. My tags come in the following format: <#data>.
The data can be letters, numbers or spaces. My colleague here at work wrote the following:
<#([^>])>
This seems to match everything fine but I'm using a CodeProject tool called <a href="http://www.codeproject.com/dotnet/Expresso.asp ">Expresso</a>[<a target=_blank title='New Window' href="http://www.codeproject.com/dotnet/Expresso.asp ">^</a>]and the match occurs only for the first character. Is there a way to make it recursively grab all the characters in between tags?
I tried this with groups and was very frustrated:
<#(?<data>([^>]+)>
It still only seems to grab the first character.
Thanks in advance...
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
|
|
lets say i execute a command line operation like this
Process cmd = null;
ProcessStartInfo options = new ProcessStartInfo(fileName, arguments);
options.UseShellExecute = true;
options.WindowStyle = ProcessWindowStyle.Normal;
cmd = Process.Start(options);
cmd.WaitForExit();
it could be a ping or anything, how can i capture the output of that instruction?
Thanks in advance
|
|
|
|
|
Set options.RedirectStandardOutput to true then you can do something like string stdout = cmd.StandardOutput.ReadToEnd() (which should come before you WaitForExit()). The problem I have is that I can't get at the StandardOutput before the process exits, so if you manage to figure that out, please let me know!
|
|
|
|
|
http://www.codeproject.com/csharp/LaunchProcess.asp
That article was exactly what I needed, but I'm not sure if that would work for anyone else
|
|
|
|
|
I've been using a number of third party COM components with VC6 and now that I am migrating to C# I beginning to dive into Interop. The manufacturer of these components won't support .Net and have no intention of migrating in the near future so I am creating wrappers for the components in question. The tlbimp utility fails with a number of errors when converting the type libraries so I am creating the wrappers by hand. So far so good - sort of. I've gotten a number of the functions in a number of the components to be accessible, my problem is finding the right data type to marshal the data as. For instance:
typedef StructList __RPC_FAR *RCStructList;
typedef struct tagSTRUCT1
{
long nVal1;
long nVal2;
double dVal1;
} Struct1;
typedef struct tagSTRUCT2
{
Struct1 S1;
Struct1 S2;
} Struct2;
struct StructNode{
Struct2 __RPC_FAR *pNext;
StructNode node;
};
struct StructList
{
StructNode __RPC_FAR *pFrst;
};
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE
GetList(
/* [in] */ RCStructList rslRequested,
/* [in] */ DWORD dwMin,
/* [in] */ DWORD dwMax,
/* [retval][out] */ StructList rslFetched
) = 0;
OK, so, I converted the first two structures like this:
public struct Struct1
{
public Int32 nVal1;
public Int32 nVal2;
public double dVal1;
}
public struct Struct2
{
Struct1 S1;
Struct1 S2;
}
It seems to work alright. So what do I do about the other two and the function call? And what happens when one of the parameters is a BSTR pointer? I've tried the UnmanagedType.BSTR to no avail, it just keeps throwing a null reference exception. On another note, I've been able to wrap the function calls alright except when the return [retval] is an interface. I use
[return: MarshalAs(UnmanagedType.Interface)] Object func_call();
But it throws an exception saying there's no such interface.
Thank you in advance for any assistance you may provide.
|
|
|
|
|
IntPtr works for all pointer types.
I think you can convert this one
struct StructNode{
Struct2 __RPC_FAR *pNext;
StructNode node;
};
like that
public struct StructNode{
IntPtr next;
IntPtr node
}
You can convert structures with Marshal.StructureToPtr() and re-convert them with Marshal.PtrToStructure().
|
|
|
|
|
I have heard that the ability exists to write Windows application in .NET that will self upgrade (do a version check on startup and silently pull down updates from a server). I suppose that ability exists in any environment if you put enough effort into it, but I was hoping there were some built-in API calls that could be made and a standard mechanism to do this. Has anyone done anything along these lines and can point me to a document or code example. Thank you.
Ron Ward
|
|
|
|