|
Hello someone who can give me some code for a fingerprint reader SDK C # MVC +

|
|
|
|
|
You're not going to get code handed to you here.
If you're looking for a C# library that means the finger print scanner would have to be connected to the web server. That's probably not going to happen. ALL ASP.NET/MVC code runs entirely on the server, not the client.
In order to use a finger print scanner on the client machine you have to have some kind of server application running on client to communicate with the scanner and expose a web server for the client javascript code to interact with it.
I don't know of any library that does this but that doesn't mean they don't exist. Just Google for "javascript fingerprint scanner" and you'll probably come up with something.
|
|
|
|
|
I am running this from one domain and against a different domain. The process is incredibly slow and I'm wondering how I can speed my code up so that instead of it taking 20 minutes, it will only take 1 minute.
I have noticed that every once in a while it will only take 1 minute and I'm wondering if I need to point it to a specific DC in the domain I am looking through or maybe something else?
getAllGroupMemberGroupsForGroup("membergroup", "domain.domain.com")
private List<string> getAllGroupMemberGroupsForGroup(string groupName, string domainName)
{
PrincipalContext context = new PrincipalContext(ContextType.Domain, domainName);
GroupPrincipal objects = GroupPrincipal.FindByIdentity(context, groupName);
List<string> groupMembersList = new List<string>();
PrincipalSearchResult<principal> objectMembers = null;
if (objects != null)
{
objectMembers = objects.GetMembers();
}
else
{
return groupMembersList;
}
foreach (Principal objectMember in objectMembers)
{
if (objectMember.StructuralObjectClass == "group")
{
string objectDomain = objectMember.Context.Name;
groupMembersList.Add(objectMember.Name + "|" + objectDomain + "|" + objectMember.DistinguishedName);
}
}
return groupMembersList;
}
|
|
|
|
|
By domain, you mean AppDomain ? If so, performance will always be terrible because it has to serialize everything when crossing a domain.
If not, then ignore this answer.
Marc
|
|
|
|
|
This doesn't make a lot of sense. Are you getting all of the group memberships of a specified user or are you getting all of the group memberships of a list of users who are members of a specified group, or what?
You never spelled out exactly what this code is supposed to be doing.
|
|
|
|
|
My goal is to enumerate through the groups and subgroups and get all of the non duplicate groups/subgroups and put them into a list.
After that I checked to see if a specific user is a member of any of the groups I've enumerated to the list of groups/subgroups.
|
|
|
|
|
"Enumerate through the groups and subgroups" of what? What is the starting object for this query? Are you returning ALL of the groups in the directory?
There is no such thing as a "subgroup". What I think you're referring to is a group that is a member of another group.
Or why not just start with the user object and get the list of groups it is a member of?
|
|
|
|
|
I am enumerating through groups recursively.
There is a starting parent group, and I'm starting with the parent and enumerating through all of the child groups of that parent and every group that is a member of the child groups that are found. At my organization, there may be a nested hierarchy of 12 groups or more and unfortunately there may be some of the same groups nested in other groups as the local admin qualification is to have a pulse.
Does that explain it better?
|
|
|
|
|
That's better.
If you are making a request to the domain controller for every group at every level, you're going through an expensive operation, every single time. Just because you're code hits one domain controller for one request does not mean that the same domain controller is going to service all subsequent requests. You could be throwing requests all over the network without knowing it.
Now, each request is expensive so it would be better to make them once and then cache the result. Create a Dictionary to cache the objects returned. When you make a request for a group, lookup the group name in the cache to see if it's there first. If not, go to the directory to get it and cache it for use next time around. Whenever you go get a list of groups, add them to the cache if needed.
|
|
|
|
|
I have not created a dictionary before, so do you recommend this be stored in a text file or in a database?
This morning I got 323 group results in 65 seconds, I would imagine that when I try after lunch it will take 10x as long.
Is it better for me to try and dictate which DC I am hitting? I can view which DC I'm hitting, so maybe my issue of sporadicness is actually a DC problem? What do you think?
|
|
|
|
|
|
any one can help please i need to create a program in c# speech convert to text in the textbox
|
|
|
|
|
Member 2146223 wrote: please give me a running program ...
Member 2146223 wrote: i need to create a program ...
They don't really work together, do they? Either we create it or you do: us giving you a program is not "you creating" it.
In the first case, no. We are not a "code to order" service.
In the second case, we expect you to try and do it yourself: then you can ask if you get stuck. Just going "give me the code" is not going to get you helped much...if at all.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hi All,
How can I monitor CPU and monitor utilisation for single process and plot in the graph. Please help me, I am stuck in my project.
|
|
|
|
|
|
<<
0 Points
1 Post
Hi,
I am using the below code to set the requestValidationMode for the particular file in web.config:
<location path="fetchdata.aspx">
<system.web>
<httpRuntime requestValidationMode="2.0">
<system.web>
<location>
Is it possible to set the same configuration at the control level in the web. config file.
i.e for only one control in the "fetchdata.aspx",need to set the requestvalidationmode to 2.0 in web.config file
If so , please let me know how to do it.
|
|
|
|
|
|
In my app, recently, I had to innovate some kind of daring concept.
Though, as it is perfectly syntactically correct, it did work fine.
This is not really a question here, more like a discussion here:
1. could I have made it more simple?
2. what do you think of it?
Enter async event!
Here is my code fragment that uses them
public event Func<Task> AlarmReceived
{
add { lock (this) eAlarmReceived += value; }
remove { lock (this) eAlarmReceived -= value; }
}
Func<Task> eAlarmReceived;
internal async Task OnAlarm()
{
if (eAlarmReceived == null)
return;
var eTasks = eAlarmReceived.GetInvocationList().Cast<Func<Task>>().ToList();
foreach (var t in eTasks)
await t();
}
modified 18-Jul-16 21:14pm.
|
|
|
|
|
It's an interesting concept.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Thanks!
I was kind of not quite surprised but almost that it worked!
|
|
|
|
|
eAlarmReceived += value;
You can treat Func<Task> as a multicast delegate? I had no idea.
I've been playing around with this, and I'm not sure of the usage:
static void Main(string[] args)
{
new Program();
Console.ReadLine();
}
public Program()
{
DoIt();
}
public async void DoIt()
{
AlarmReceived += () => new Task(() => Console.WriteLine("A"));
AlarmReceived += () => new Task(() => Console.WriteLine("B"));
await OnAlarm();
}
That compiles but "A" and "B" never print -- what's a simple example of adding tasks to AlarmReceived?
[edit]
Never mind, I see what I was doing wrong. This works:
AlarmReceived += () => Task.Run(() => Console.WriteLine("A"));
AlarmReceived += () => Task.Run(() => Console.WriteLine("B"));
Now on to your question...
Marc
|
|
|
|
|
Glad you learned something Marc!
|
|
|
|
|
If this:
AlarmReceived += () => Task.Run(() => Console.WriteLine("A"));
is the correct syntax, then this:
AlarmReceived -= () => Task.Run(() => Console.WriteLine("A"));
doesn't unwire the delegate because it's a new instance. This "simpler" case (the way I might have tried it, because I didn't know about the multicast thingy) also doesn't unwire the alarms:
static void Main(string[] args)
{
new Program();
Console.ReadLine();
}
public Program()
{
DoIt2();
Console.WriteLine("Waiting for alarms to process...");
}
List<Action> alarmActions = new List<Action>();
public void AddAlarm(Action act)
{
alarmActions.Add(act);
}
public void RemoveAlarm(Action act)
{
alarmActions.Remove(act);
}
public async void DoIt2()
{
Console.WriteLine("Adding alarms");
AddAlarm(() => Alarm1());
AddAlarm(() => Alarm2());
await Task.Run(() => ProcessAlarms());
Console.WriteLine("Removing alarms");
RemoveAlarm(() => Alarm1());
RemoveAlarm(() => Alarm2());
await Task.Run(() => ProcessAlarms());
}
public void ProcessAlarms()
{
alarmActions.ForEach(a => a());
}
public void Alarm1()
{
System.Threading.Thread.Sleep(1000);
Console.WriteLine("Alarm 1");
}
public void Alarm2()
{
Console.WriteLine("Alarm 2");
}
The only way to remove them is to instantiate the Action so the action isn't an anonymous method.
Action a = () => Alarm1();
Action b = () => Alarm2();
Console.WriteLine("Adding alarms");
AddAlarm(a);
AddAlarm(b);
await Task.Run(() => ProcessAlarms());
Console.WriteLine("Removing alarms");
RemoveAlarm(a);
RemoveAlarm(b);
await Task.Run(() => ProcessAlarms());
That approach is risky because, as the previous example showed, you could certainly wire up the alarm as an anonymous method, and the unwary programmer might think you can unwire it that way too, but you can't.
In your case, because AlarmReceived is an event of Task, I don't see how you can get away from an anonymous method:
Task a = Task.Run(() =>
{
System.Threading.Thread.Sleep(1000);
Console.WriteLine("A");
}));
AlarmReceived += () => a;
The funny thing is, this ACTS like the event has been unwired because the task has been run!
Given:
public async void DoIt()
{
Task a = Task.Run(() =>
{
System.Threading.Thread.Sleep(1000);
Console.WriteLine("A");
});
<pre>
Task b = Task.Run(() => Console.WriteLine("B"));
AlarmReceived += () => a;
AlarmReceived += () => b;
Console.WriteLine("Processing alarms");
await OnAlarm();
Console.WriteLine("Unwire");
AlarmReceived -= () => a;
AlarmReceived -= () => b;
await OnAlarm();
}
internal async Task OnAlarm()
{
if (eAlarmReceived == null)
{
Console.WriteLine("eAlarmReceived is null!");
return;
}
var eTasks = eAlarmReceived.GetInvocationList().Cast<Func<Task>>().ToList();
if (eTasks.Count == 0)
{
Console.WriteLine("Nothing to do!");
}
else
{
Console.WriteLine("Tasks = " + eTasks.Count);
foreach (var t in eTasks)
await t();
}
}</pre>
The output is:
Processing alarms
B
Tasks = 2
Waiting for alarms to process...
A
Unwire
Tasks = 2
But again, the use of the anonymous method for AlarmReceived means you can't unwire it.
Am I doing something different in the use case than you are?
Marc
|
|
|
|
|
Marc Clifton wrote: But again, the use of the anonymous method for AlarmReceived means you can't unwire it.
The same problem applies to regular events as well.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|