|
Interesting question.
Firstly, I think you need to be sure on how each GPS would connect. You suggest TCP, you need to get this confirmed and you need to find out whether it connects, delivers its information then disconnects (likely) or it leaves the connection open (unlikely).
How many GPS units are you talking about, how many thousand? If it's a thousand, and they update twice a minute you're only looking at 33 connections/second which I don't find in any way scary. From what I know about GPSs (which isn't a great deal) they normally send a very small packet just containing location information.
Then I'd implement a producer-consumer queue. Each incoming connection takes the data and just sticks it on the queue and disconnects. On the other end you have something (or more than one) which pulls these off the queue and writes them to the database.
I'd go for asynchronous constructs (BeginAccept, BeginReceive) on the reception end as these won't require a long running thread and scale well.
Regards,
Rob Philpott.
|
|
|
|
|
how to make slave monitor show something same as primary monitor? thx
|
|
|
|
|
Easiest way is to set it in your display properties: Right click the desktop, select Screen Resolution, and set "Multiple Displays" to "Duplicate these displays"
Or, use WIN+P then select "Duplicate"
Can you do this from C#? Dunno - you may be able to via the registry, but that would need an elevate application which means kicking the UAE - so your user has to react to that anyway.
What exactly are you trying to do?
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Thank your replay.My os is xp, that does not suppport to set "Multiple Displays" to "Duplicate these displays", it just support extend primary monitor to slave.
I need to use double monitors in project, and make slave monitor show want i do for customer in sometimes,so i want to do this with c#
|
|
|
|
|
On my XP laptop the duplicate display functionality is available only through the graphics adapter manufacturer's own control panel (nvidia). I do find it's of limited use unless the resolution and geometry of both displays are the same.
For example if I attach a 1024x768 external monitor then the laptop's 1400x1050 display will only use the central 1024x768 portion.
Alan.
|
|
|
|
|
how to create a background worker function that run to generate a long-running report on a diferent thread?
|
|
|
|
|
|
Rather than using a BackgroundWorker, try using the Task Parallel Library.
|
|
|
|
|
I am trying to trace IP-Address who is deleting files from my share folders. I have write a code to get information when trying to do something in my share folder but, I can't get the IP from where the delete event's is occurred.
Yes.......
|
|
|
|
|
Yep. Windows doesn't track where the command came from.
This sounds more like someone shouldn't have permissions to your shared folder. Did you setup security on the share or did you just let "Everyone" have Full Control permissions over the folder?
|
|
|
|
|
If you know the shared folders, you would be much better off restricting who has access to the share.
|
|
|
|
|
In the below code sample, a base class constructor was called, with an object created in the argument list. I need to dispose the object created in the argument list. Sample code below
//base class constructor
public Class1(String str, Dbcontext dbcontext)
{
this.str = str;
this.dbcontext = dbcontext;
}
...
//derived class
public Class2(String str, Dbcontext dbcontext):base("xxx", new YYYEntities)
{
}
Please share your thoughts to dispose the highlighted object created.
Adam
|
|
|
|
|
The GC will do it.
Any particular reasons why you're asking, or just curious?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Not your job. If you didn't create it, don't destroy it. If you didn't open it, don't close it. If you didn't set it, don't clear it.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
I am able to create a XML file like this:
="1.0"
-<testsuite>
<Name>testsuite</Name>
<Address>Colony</Address>
<Char>arc</Char>
</testsuite>
With the following code:
XmlTextWriter textWriter = new XmlTextWriter("C:\\XML files\\API_PASS.xml", null);
textWriter.WriteStartDocument();
textWriter.WriteStartElement("testsuite");
textWriter.WriteStartElement("Name", "");
textWriter.WriteString("testsuite");
textWriter.WriteEndElement();
textWriter.WriteStartElement("Address", ""); textWriter.WriteString("Colony");
textWriter.WriteEndElement();
char[] ch = new char[3];
ch[0] = 'a';
ch[1] = 'r';
ch[2] = 'c';
textWriter.WriteStartElement("Char");
textWriter.WriteChars(ch, 0, ch.Length);
textWriter.WriteEndElement();
textWriter.WriteEndDocument();
textWriter.Close();
*) But I was required to add some more detail for the first element (keep the last line as it is), for example:
-<testsuite errors="0">
I tried to add in the:
textWriter.WriteStartElement("testsuite errors=\"0\");
but it shows nothing in the xml file
Anyone can help?
|
|
|
|
|
You don't need to write another element, but an attribute[^] inside that element.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
code snippet for adding attribute in xml:
xmlWriter.WriteStartElement("testsuite");
xmlWriter.WriteAttributeString("errors", "0");
|
|
|
|
|
Hi all, is it possible to write to a file using a StreamWriter object while the file is open. What I'm trying to do is create a webpage for personal use that will serve as a webpage editor. In this page there will be an iframe, 2 text boxes and a button which will be used to specify which page element to modify.
In the iframe of this page I want to be able to open any webpage in my domain. Then I want to be able to modify things on the page inside the iframe such as text and images. I'm planning to read the code and markup of the page being displayed in the iframe using a StreamReader object, and modify it using a StreamWriter object while it's still open.
Is this doable? Please comment, thanks in advance.
modified 17-May-14 4:56am.
|
|
|
|
|
Hi,
I need to create a usercontrol containing a listbox and a scrollbar in order to be able to skin the scrollbar.
Unfortunately, I have to recode all listbox's methods if I want my usercontrol to have the same behavior as a classical Listbox...
Is there a better way to reach all the listbox's methods without recoding them all ?
Thanks in advance, that'll be very usefull
|
|
|
|
|
Why would you want to do this in the first place? And why do you think you will have to recode all the ListBox's methods? Isn't that why OOP includes inheritance?
|
|
|
|
|
Don't think he can inherit - sound like he is encapsulating the Listbox and a Scrollbar, so he can't inherit directly from the ListBox. Which means he has to provide pass-through methods or expose the ListBox directly - which he doesn't want to do.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
|
If you want to access events of listbox in usercontrol without extra effort, not possible.
If you want to access properties of listbox, create a property in Userclass.
public ListBox listBox
{
get { return listBox1; }
}
and you need to define all required events;
public event EventHandler ListBoxClick
{
add { listBox1.Click += value; }
remove { listBox1.Click -= value; }
}
Tim Toady Bicarbonate
modified 17-May-14 17:04pm.
|
|
|
|
|
Learn WPF. This is EXACTLY what its intended for. ZERO C# to skin a control and its scrollbars.
|
|
|
|
|
Thanks for all four replies
I came to the evidence that I need to learn WPF
|
|
|
|