|
using (TextWriter writeEvent = new StreamWriter("datebook.txt", true))
The second argument in the constructor tells it whether to overwrite (false) or append (true).
|
|
|
|
|
Hello...
I have a question. Is C#.NET able to be used for application for data acquisition with sample rate 10ms ?
Are there probably any problems with GarbageCollector ?
If I read the data each 10ms, the garbage collector probably doesn't have time to run.
Must I use C or C++ for that ?
Thanks...
|
|
|
|
|
stancrm wrote: If I read the data each 10ms,
You're probably not "just" going to read it, obviously, and I guess you'd like to store it. Probably in memory, until you got enough to write to..
Isn't there some kind of device-driver for the gizmo that you want to read from?
BTW, Windows' does not guarantee a minimal amount of CPU-time and it might decide to put you on hold in favor of the other processes.
I are troll
|
|
|
|
|
When it comes to time critical stuff, Windows is pretty rubbish. Low(er) level C stuff talking directly to the hardware is pretty much the only way to go. Once that's done, it's possible to create a C# wrapper around the unmanaged stuff.
Disclaimer
This is just from my experience of messing with ASIO (audio stuff), and may not be accurate for your situation!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
DaveyM69 wrote: When it comes to time critical stuff, Windows is pretty rubbish.
With the price of hardware one might decide on using a complete computer with QNX[^] as a peripheral device to the Windows host
I are troll
|
|
|
|
|
Cool... very cool
Link saved for further investigation!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi,
Windows is not a real-time system, it can't and doesn't guarantee a maximum latency time.
If you need to get something done every 10 msec no matter what, then you need something else.
OTOH if there is sufficient buffering, and all you need is accepting the data, but not immediately act on it, you might well be able to solve it with a Windows app. A simple example is data coming in over a serial line, say 1 character every 10 msec; if your buffer is 10KB it can hold 100 seconds' worth of data, so the app should be capable of processing that under all but the most extreme load conditions.
BTW: if the sample timing is important, you better have an external means as a sample clock; Windows sucks at creating small and precise time intervals.
Luc Pattyn [Forum Guidelines] [My Articles]
- 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 the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I launch application B from application A. When i close application A i need to close application B.
I RDC to a remote server and launch application A and launch B from A. When i close A it looks for B and kills it. However it goes and kills application B in another RDC session.
How do i differentiate the process launched in the session i logged into?
Any help would be greatly appreciated.
|
|
|
|
|
Well, there are quite a few ways to launch a process... In this case, why not start it using the System.Diagnostics.Process class, and just keep a reference to that object?
private Process appB;
public void LaunchAppB()
{
appB = new Process();
appB.StartInfo.FileName = "...";
appB.Start();
}
public void KillAppB()
{
if (!appB.CloseMainWindow()) appB.Kill();
}
(Note: You generally want to try CloseMainWindow first, which will try to close the app in the usual manner, like clicking the X. If that doesn't work, you kill the process. Depending on exactly what you're doing here, you might need to make it more sophisticated, perhaps giving it a few seconds to close properly and killing after that, or something of the sort)
|
|
|
|
|
The context in which i close the application i cannot maintain the instance. Thanks for the response.
I found a solution. Check below:
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr FindWindow(string sClassName, string sWindowTitle);
[DllImport("user32.dll")]
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
uint processId;
IntPtr hProgram = WebApp.FindWindow(null, ".....");
GetWindowThreadProcessId(hProgram , out processId);
System.Diagnostics.Process.GetProcessById((int)processId).Kill();
|
|
|
|
|
I might suggest there is a problem with GetWindowThreadProcessId, I do UI automation testing, i was looking a using GetWindowThreadProcessId a few weeks ago. Bottom line from what i found if you are on Win95, or NT 3.51, GetWindowThreadProcessId should work fine, on Vista I thought i remember seeing warning about it not working correctly.
Alternatively, i might suggest 1.) Make sure you app is modal, that only one instance of it can be running. 2.) Get the process by GetProcessesByName() for your process, and then issue a kill on the process you find, well if it is still running.
HTH,
dan d;)
|
|
|
|
|
hi there, i need some kind of references to, "how i can find how many bits the computer sent and recieve over the lan?"
i need it in my C# application, is there any Library or any link that i can study ?
|
|
|
|
|
|
Can somebody tells me how long the connection to the database stays open if the connetion is not closed in the function.
If connetion stays open, meanwhile can we do the database restore or backup. Will that cause a problem.
Thanks
|
|
|
|
|
i am not sure but as the expierience says open connections will be closed automatically after sometime that is being idle,
for backing up and restore u should close all open connections(u can simply drop the database) ,otherwise u'll recieve error
|
|
|
|
|
I am not convinced why one need to have database connection closed while performing the database backup. However, database restore make sense.
Can you elaborate little more or perhaps a resource that may help me out.
|
|
|
|
|
A couple of the most obvious reason for me would be, a database may not flush data to disk until a connection is closed, or a connection could be in the middle of a long running operation, possibbly in a transation or not, backing up the database when this long running operation is in the middle of doing what it needs to.... Your data if you restore it in the backed up state you'll have data corruption.
|
|
|
|
|
inner code {
Public class thePatient
{
public class theName
{
public string use;
public string prefix;
public string FirstName;
public string Middle;
public string LastName;
public string Suffix;
}
public theName[] Name;
public thePatient()
{
Name = new theName[1]; <-- How do I properly declare this
}
}
public CN()
{
Patient = new thePatient();
}
}
I don't want set the number values in the array in the class... How do I declare that value properly... and yet be able to have multiple name objects when referencing this nested class.
It would be even better if I could use an 'Add' and 'Remove' concept.
modified on Wednesday, March 25, 2009 3:19 PM
|
|
|
|
|
Go for list instead of array if you are not sure of the size at design time. It will also give some useful complimentary methods which are not there in array.
जय हिंद
|
|
|
|
|
plus I like it too
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Why not use a generic list?
public class Patient
{
public Patient()
{
_Names = new List<Name>();
}
private List<Name> _Names;
public Name[] Names
{
get { return _Names.ToArray(); }
}
public void AddName(Name name)
{
_Names.Add(name);
}
public void RemoveName(Name name)
{
_Names.Remove(name);
}
public class Name
{
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi,
I am fighting with COM again , ow I'm struggling with following problem:
Let's say we have COM interfaces defined as:
IA : IUnknown
IB : IA
IC : IB
What I've tried to do is creating C# interfaces:
[ComImport, System.Security.SuppressUnmanagedCodeSecurity,
Guid("00-this-is-valid-guid-000"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IA
{
method1();
}
The same for IB, with following difference:
interface IB : IA
IB does not duplicate IA's methods. The same for IC.
Now, when I try to create instance of IC using other COM method (from another interface) I receive error (Exception from HRESULT: 0x88990012 to be exact - but I guess that wont be helpful).
When I copy-paste method1() from IA to IB, and remove inheritance, but leave inheritance between IB and IC the code seems to work. What is even more surprising, I have pretty the same situation with other "inheritance tree" (IA -> IE -> IF) and I don't have problems with them, what is even funnier, when i completely remove IA, interfaces IE and IF are working properly. Does anyone have an idea what is exactly going on, or have any references that could help me solve that one? (I've read tons about marshalling and COM on msdn, but I haven't found answer for this one).
To be exact: All methods from interfaces are defined in correct order (the same order as in *.h file), but some methods has invalid argument (no arguments, even though they should take some, this seems to not break anything, as long as those methods are not invoked of course, and make developing easier (I start with blank ones, and fill the ones I need).
|
|
|
|
|
hi
how can insert a button into textbox left such as component one or dat net bar with object oriented programing
i mean inherit from textbox and button
thanks every one
|
|
|
|
|
1. Create a panel with same background color as that of your textbox.
2. Place your textbox in the panel with border set to none.
3. Add a button to the panel.
4. Set the size for each of them such that it looks like a textbox with button in it.
5. Use proper anchoring and dock to make sure the appearance is same regardless of size of the form.
If you need to use this in many places, make this a user control. Or else you can do this directly on your form if you are using this only in one form.
जय हिंद
|
|
|
|
|
yes i need many times but i have some problems
i must create a class library project or windows control library project?
thanks
|
|
|
|