|
Im sorry for not stating clearly.
Are you familiar with the OMR sheets? Our format is similar with that but instead of bubbles its just square. And for the master key, we made gui for it and inside the gui are the 100 items with 5 choices from A-E. We can edit the master key everytime we check an exam. So the problem is we still don't know how can we compare the scanned answer sheet of the students and our master key so that we can get the correct answer.
I hope this will do.
|
|
|
|
|
It's going to take some image processing to "find" the possible answers on the sheet and identify which answer was selected for a question.
To this end, you'll also have to come up with some kind of way to denote which question answers appear where on the page and also which answer would be the correct one, for every question on the page. You'll have to build a map of this data.
BTW: This will be time consuming for the person using the system.
Google for "machine vision" and start reading. You're going to have to do a bunch of research on this one.
|
|
|
|
|
I used the following code for multi-threading, The code works fine but much slower if I add the tasks[nData].wait() command see below "*****" but if I remove the tasks[nData].wait() command then the code generates all the task but only gathers information for approximately 150 task then stops. Can anyone tell me why this is happening and what I can do to correct this problem.
Any help will be greatly appreciated.
Michael
public Boolean LoadData()
{
Boolean bComplete = false;
Int32 nTotalData = 10000;
this.tasks = new Task[nTotalData];
DateTime dtStartTime = DateTime.Now;
ProcessingBarsCS.StartTime();
var parent = Task.Factory.StartNew(() =>
{
dtStartTime = DateTime.Now;
for (Int32 nData = 0; nData < nTotalSymbols; nData++)
{
bComplete = GetData_Task(nData, dtStartTime, nTotalData);
}
});
parent.Wait();
ProcessingBarsCS.StopTime();
return bComplete;
}
Boolean GetData_Task(Int32 nData, DateTime dtStartTime, Int32 nTotalData)
{
DataCS dataCS = new DataCS();
tasks[nData] = Task.Factory.StartNew(() =>
{
nData = dataCS.Data();
})
.ContinueWith(antecendent => ProcessingData(nData));
tasks[nData].Wait();
try
{
Task.WaitAll(tasks);
SetData_ElapsedTime(dtStartTime, nTotalData);
}
catch { }
return true;
}
|
|
|
|
|
My guess is that you had a SystemOutOfMemoryException . Try to check the Event Viewer for possible error messages that the application has thrown. Also it would be wise to set a limit for the number of tasks that will be created so as not to overload your machine.
Signature construction in progress. Sorry for the inconvenience.
|
|
|
|
|
Walking this code through:
- You start a new
Task ; - You call
GetData_Task 10000 times in a loop; GetData_Task creates a new Task and immediately waits for it to complete;GetData_Task then waits for all 10000 tasks - most of which haven't been created yet - to complete, catching and ignoring the ArgumentException thrown when the WaitAll method encounters the first null element in the array;- The
LoadData method then waits for the parent Task to complete;
No wonder your code is slow!
This code looks like a suitable candidate for the Parallel class[^]:
public bool LoadData()
{
const int nTotalData = 10000;
DateTime dtStartTime = DateTime.Now;
ProcessingBarsCS.StartTime();
Parallel.For(0, nTotalData, nData =>
{
var dataCS = new DataCS();
var result = dataCS.Data();
ProcessingData(result);
});
SetData_ElapsedTime(dtStartTime, nTotalData);
ProcessingBarsCS.StopTime();
return true;
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello,
in my program i have an exception, because i want to synchronize a local directory with a networkDirectory (write Protected).
Message:
Microsoft.Synchronization.MetadataStorage.MetadataStorageEngineException: Fehler bei einem Speichermodulvorgang. Fehlercode: 25039 (HRESULT = 0x80004005, Quellen-IID = {0C733A7A-2A1C-11CE-ADE5-00AA0044773D}, Parameter=(0, 0, 0, H:\filesync.metadata, , , )).
---> System.Runtime.InteropServices.COMException: Fehler bei einem Speichermodulvorgang. Fehlercode: 25039 (HRESULT = 0x80004005, Quellen-IID = {0C733A7A-2A1C-11CE-ADE5-00AA0044773D}, Parameter=(0, 0, 0, (sourceNetworkDirectory)\filesync.metadata, , , )).
I would like to avoid writing the 'filesync.metadata' to the sourceDirectory, or maybe change the path for writing the metaFile
Can someone help me?
Greetings
Andre
|
|
|
|
|
Hi,
i would like to know best way to develop an application which runs locally. Here is my requirement and how i used to do all these days
Requirement:
1. Develop a application which runs on a frequent interval(may be 1 minute once) in a windows server class os
2. Do something locally and pass the information to remote server by calling a WCF service
Below is the method i used for the above requirement.
1. Develop a windows service application using (VS 2010 ->New project->C#->Windows->Windows Service)
2. Add a Timer and specify Timer.Interval is 1 minute
3. Write a function to do something
4. Call the function in Timer_Elapsed
5. Add installer (ServiceInstaller and ServiceProcessInstallar)
6. Build the applcation
7. Install this app as windows service and start it. (Can be viewed in services.msc)
Kindly let me know is there any better way to do the above.
Thanks in advance
Regards,
Murugesan
|
|
|
|
|
murugesancodeproject wrote: Kindly let me know is there any better way to do the above. Write a normal app, execute it every minute using the Task Schedular[^].
Having your own timer-service would be more resource-intensive, and Windows-services are harder to debug than normal windows apps.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
One reason I might use a Service versus the suggested alternative in the other post (scheduler) would be if I want to insure that the task doesn't run too often or too seldom. The scheduler allows it to be changed, turned off.
However insure that a windows service correctly shuts down if the task is still running when a user attempts to shut down the service or on a reboot.
|
|
|
|
|
Hi All ,
I am Working In Visual Studio 2010. I am Making Dashboard in WindowsFormsApplication Project using C#. I am Using SqlServer2005 for database.I take two DataGridView in one form in first grid i fill data on form load event. In second grid change value on click of first grid. Now i want to change value in second grid using keyboard arrow key..
Please Help me....
|
|
|
|
|
Help you with what? You haven't asked a question. All you did was provide a short list of what you want to do with insufficient detail about the platform you're using, specifications on the size of the data sets you're dealing with, which grid control you're using, blah, blah, blah, ...
So, given the complete lack of detail in your question, the only answer anyone can give you right now is, "Permission granted! Please, proceed."
|
|
|
|
|
Hi,
while sending SOAP envelope with xml content to the recipient service with credentials e.g(userName ,Password) i am not able to send the request.
I am just having IP addreess and Port of the recipient.
Below code I am using for that :
string username = "XXX"
string Password = "YYY"
string Methodname = "ABC" // Method Provided
//Converted string in Base 64 format for username & password
var headerFormat = "Basic {0}";
var authHeader = string.Format(headerFormat,
Convert.ToBase64String(Encoding.UTF8.GetBytes(Uri.EscapeDataString(username) + ":" + Uri.EscapeDataString(Password))));
//web request made for SOAP
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(“https://192.168.0.1:11111/”);
req.Headers.Add("SOAPAction", "https://192.168.0.1:11111/" + Methodname );
//Authorization added to SOAP web request header.
req.Headers.Add("Authorization", authHeader);
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
req.GetRequestStream()
Please help to sort out this problem.
Thanks and Regards,
Rahul Joshi
|
|
|
|
|
vaibhavData wrote: i am not able to send the request.
Why are you "not able to send" it? Are you getting an exception? What exception and where?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I am getting the below exception on webrequest.GetRequestStream()
Inner Exception Message :
A connection attempt failed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond
192.168.0.1:11111”
|
|
|
|
|
i want the detail about memory mangement in dot net with example.
|
|
|
|
|
Try the documentation[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Good day!
How to make the gradient of the arc, such as an ellipse, the color changed depending point on the ellipse from a certain point.
WPF technology, i use to draw DrawingContext
|
|
|
|
|
If you're just wanting to draw an arc in WPF, you can use this[^] code. Where WPF is really clever, is in its ability to allow you to easily swap brushes around. You might want to use a LinearGradientBrush in the Stroke , to satisfy your need for a gradient.
|
|
|
|
|
|
I have some code that checks a remote machines service to ensure it is all good. It installs as a service which I have tested as local system and network service and I get the
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
error. if I manually add a user to the application it works fine here is the part of code I am using to try to pass the alternate credentials any help would be appreciated
ConnectionOptions op = new ConnectionOptions();
op.Username = "xxxxxxx";
op.Password = "xxxxxx";
op.Impersonation = ImpersonationLevel.Impersonate;
op.EnablePrivileges = true;
ManagementScope scope = new ManagementScope(@"\\192.168.1.103\root\cimv2", op);
scope.Options = op;
SelectQuery query = new SelectQuery("SELECT * FROM Win32_Service WHERE Name =" + servicename);
using (ManagementObjectSearcher ser = new ManagementObjectSearcher(scope, query))
{
ManagementObjectCollection services = ser.Get();
foreach (ManagementObject service in services)
{
}
}
|
|
|
|
|
Andre O Rahming wrote: if I manually add a user to the application it works fine here is the part of
code I am using to try to pass the alternate credentials any help would be
appreciated
sorry, I dont get that bit
Are you using Active Directory at your site ? - 'in loose terms', I'd create an AD profile witht he appropriate permissions, that can be used on each machine, and the service uses it and your service checker gets 'run as' the 'service profile' (that would have to be a safer way, rather than requiring hard-coded accounts/credentials in code)
'g'
|
|
|
|
|
Have a look at the user account under which you are running the service.
This account may not have access to WMI.
|
|
|
|
|
Also check that the account has access to network resources. I am not sure, Local System may lack them, try Local Network Service.
|
|
|
|
|
Hi,
I'm very new in c# code. I would like to have a list a windows that open in current desktop in window z order.I have go through the internet and found this code
public partial class Form1 : Form
{
public const int GW_HWNDNEXT = 2;
public const int GW_HWNDPREV = 3;
[DllImport("user32.dll")]
static extern IntPtr GetTopWindow(IntPtr hWnd);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "GetWindow", SetLastError = true)]
public static extern IntPtr GetNextWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.U4)] int wFlag);
public Form1()
{
InitializeComponent();
}
public static Form GetTopMostWindow(IntPtr hWnd_mainFrm)
{
Form frm = null;
IntPtr hwnd = GetTopWindow((IntPtr)null);
if (hwnd != IntPtr.Zero)
{
while ((!IsWindowVisible(hwnd) || frm == null) && hwnd != hWnd_mainFrm)
{
hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
try
{
frm = (Form)Form.FromHandle(hwnd);
}
catch
{
}
}
}
return frm;
}
}
My question how to get the GetTopMostWindow() return value from form1() class?
Thank you
|
|
|
|
|
bunge-bunge wrote: My question how to get the GetTopMostWindow() return value from form1() class?
Form1.GetTopMostWindow(Application.MainForm.Handle);
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|