|
I'm writing an windows service, which accept connections via a TCP/IP socket. I want to verify the connectin users against windows accounts on the local machine.
Do anyone know if there are somthing in .net to do this??
I have looked in System.Security.Principal, but all I could find was "current loged on user", which is not much of help. I would like to have somthing where I pass a username and password and get "accept / denied" or perhaps a usergroup or simular back.
Ola Ericsson
|
|
|
|
|
I need help coding the following pseudo code into C#.
The 3 algorithms are search methods for a program which can look through a set of data to find the subsequence of values which add
up to the highest total value.
So for example with the data set.
10 -6 12 -17 9 8 -2
the algorithm(s) show that the "best" value was 17 from array index 4 to array index 5 if you go through it. (9 + 8)
10 - 6 = 4
10 - 6 + 12 = 16
10 - 6 + 12 - 17 = -1
10 - 6 + 12 - 17 + 9 = 8
10 - 6 + 12 - 17 + 9 + 8 = 16
10 - 6 + 12 - 17 + 9 + 8 - 2 = 14
-6 + 12 = 6
-6 +12 -17 = -11
-6 +12 -17 + 9 = -2
etc
For every possible start position // every array index
For every possible end position // rest of array from current start
{
Set subtotal to 0
For every value in subseq // between current start and end
Add profit value to subtotal
Update subseq info when subtotal exceeds current best total
}
For every possible start position...
Set subtotal to 0
For every possible end position...
{
Add end position’s profit value to subtotal
Update subseq if subtotal exceeds current best total
}
Set start position to 0, subtotal to 0
For every profit value... // index from 0 to end of array as end position
{
Add value to subtotal
Keep subseq info (start, end, total) if total exceeds current best
If total is less than 0,
set start position to next index and set total to 0
}
I need help creating C# versions of these methods which compile and run.
Thanks
|
|
|
|
|
How far have you got in trying to do your homework ? WE're not going to do it for you.
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 )
|
|
|
|
|
srmanuel wrote: I need help creating C# versions of these methods which compile and run.
What is it that you need help with, specifically?
The assignment is pretty straight forward. The work to figure out how the code should work is already done, you just have to write the code itself.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hy everyone!
does anyone of you know how to insert checkboxes into datagrids?
if i search the net for hints there are just solutions for VB but none for C#. I guess if it is possible to do it in VB then it should also be possible in C#. When I do it in a similar way the only result is tons of error/compile messages because I can't bind them etc.
Does anyone know if it is possible in C#?
thanks.
Stephan.
|
|
|
|
|
simple solution
use datagridview
better and more powerfull tool
if not i think it goes like this:
DataGridColumnStyle Collection and add a DataGridBoolColumn
Have Fun
Never forget it
|
|
|
|
|
hy everyone!
i do have a program which allows me to syncronize with ldap etc. to get the user data from active directory to this program. then i do have a service, which accesses this program using the login info (username and password).
so what i want to do is to install it on different computers or to call it from different computers and use the credentials of the current user logged in to get access to my program.
to visualize it's something like that:
PC => SERVICE => TOOL/PROGRAM
the logindata in the tool will be the same as they are on the pc. but i have to send them to the tool via the service.
does anyone know how to retriev these infos to allow me sending them via my service to the program to log in?
thanks.
Stephan.
|
|
|
|
|
Well, you can't retrieve password from current user... As far as i know, there is no way you can do it without additional password recovery programs...
|
|
|
|
|
|
yup, i guess this is the easiest way, but won't work when sending it with the request
well the tool on the other side provides a native login as well, meaning you are able to log into it using you domain info. or you are able to import it into it. so i wonder which way this tool gets the info out of the active directory. because the same thing is what i need
|
|
|
|
|
Well, wanna know how to insert text in other programs or click the button in other application etc... And is it possible?
|
|
|
|
|
you mean you do have two programs and you want to send strings from one program to the other? or to click a button from application 1 in application 2?
is it possible for you to include one appliction (or the sources respectively) into the other? if so, then you are able to access the class and if you used public etc. then you are also able to access this function from application 2 in application 1.
if you do not want to include it, well then i guess you have to do it by writing it to a tempfile via a stream and parse it by the other program once again.
well, maybe you could describe your idea/problem in a more detailed way, then it's easier to answer your question.
Stephan.
|
|
|
|
|
If you have the source for both, you can write ways for the to communicate. If not, it's theoretically possible, but never going to be easy, or reliable. You would basially look for the handles to textboxes and buttons and send them WM_ messages.
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 )
|
|
|
|
|
The purpose of the code I am trying to create is to read data from a database. What I am trying to do is (when I run the exe file (on my desktop) of my code) to access my access database (mdb) which is burnt on a CD.
In order to do that I have to know the path of the mdb file.
I dont want to hard code and say D:\test\my.mdb because the driver name can be anything (for instance at my home computer the CD drive is called E:)
So i have 2 questions:
1- What is the code for retreiving the driver name (D or E or etc)?
2- If the user has multiple drivers, is there a way to find out which one s/he put the CD and retreive that driver's name?
Thank you in advance!
|
|
|
|
|
Hi,
here is how:
- get all the drive letters in use from DriveInfo.GetDrives
- for each of them inspect DriveInfo.DriveType
- when equal to DriveType.DCRom, go look for your .mdb file
If your system has multiple CD/DVD drives, and more than one contain a medium with your file,
it is up to you to choose!
FYI: the above would also find virtual CD/DVD drives, like the .iso files opened by
"deamon tools".
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks for the reply Luc,
Do I have to add any libraries under the "using" section, in order to make DriveInfo recognizable?
|
|
|
|
|
Hi 4602860,
you never need using statements, you can always use the fully qualified class name;
you may choose to add a using statement for comfort.
Which one it needs is hidden in the documentation of every .NET class.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
foreach (System.IO.DriveInfo drive in System.IO.DriveInfo.GetDrives())
{
if (drive.DriveType == System.IO.DriveType.CDRom && drive.Isready)
;
}
Eslam Afifi
|
|
|
|
|
|
You can use DriveInfo.GetDrives Method[^] to retrieve list of drives. Using DriveType property of DriveInfo class you can check whether the drive is Cd drive or not and you can use IsReady property to see if drive is ready or not.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Or you could just ask the user where the data is using an OpenFileDialog...
|
|
|
|
|
Any one tell me How To Put Value at Runtime in DataGrid
|
|
|
|
|
Create some kind of datasource, like a DataTable, and put your data in that, then bind the DataGrid to it.
|
|
|
|
|
Hi,
Is there a metod to hook to CreateWindow, or WM_CREATE in C#?
|
|
|
|
|