|
Hmmmm,
Interesting issue. I know we have had similiar issues in the past =
Can I ask how the clients get the update file in the first place ? Is it from some Web Service or do they just download it etc?
I'm also presuming that the Actual application itself which opens this XML file will know that it is possible that it will run SQL on potentially multiple different databases (i.e. ones with different schemas and potentially different versions).
If that is the case then why not actaully send down a ZIP file or Cabinet file with several XML files. One primary XML file with essentially a manifest set of nodes - each one referencing one of the other XML files in the zip/cab, seperated by Version/Schema.
For example the primary XML file might look something like this...
<manifest>
<file version="SQL2000" schema="XXXX" filename="Xmlfile1.xml" />
<file version="SQL2000" schema="YYYY" filename="Xmlfile2.xml" />
<file version="SQL2000" schema="ZZZZ" filename="Xmlfile3.xml" />
<file version="SQL2005" schema="XXXX" filename="Xmlfile4.xml" />
</manifest>
It would then be up to the app itself to work out which version of client database and which schema (or whatever criteria you need) and then check this against the manifest XML file and then load in the relevant SQL xml file and then run the SQL contained within it.
Whilst it may seem inefficient to ship all the files to every client, once it's zipped or compiled into a cabinet file the actual file will be pretty small and you also enjoy the benefit of keeping the update logic seperate for each schema/database type.
Mark
|
|
|
|
|
Hi Mark,
many thanks for response in regards to my question. The way the system will work is that we send an update to the client, they are than able to upload this xml file using the application, the application then applies the updates contaied within the file.
We really want to be able to move away from shipping files with multiple versions, as we want the updater to be completly version independent.
The reason we have chosen XML initially is that we can compare old xml to new xml file to genreate the necessary insert, updates and deletes. Plus if there are new columns it just means tewaking the sql that outputs the xml. Where as to do it by an object model, any methods/fucntions have to be all updated to cope with new columns/tables and any calls to those methods/functions must be updated. This would be laborious, unless there was a method to do it dynamically. The reason we are looking at an object model is that all our programming in the system uses this and we would like to replicate that for ease of use, but I do understand that XML is the most appropriate method.
Thanks again
Paul
|
|
|
|
|
Hello,
I need to find a way to manipulate the displaying of the "From" email address. Since I am also using the Sender field to send the email message on behalf of the Sender. So the the person who receives the message will see some thing like this from the email header (I am using the .Net CDO Mail API):
From: jblow@abc.com on behalf of jdoe@xyz.com
To: john@hotmail.com
Here is the sample code that I have used:
cdo = Server.CreateObject("CDO.Message");
cdo.From = "jdoe@xyz.com";
cdo.ReplyTo = "jdoe@xyz.com";
cdo.To = "john@hotmail.com";
cdo.Sender = "jblow@abc.com";
...
What I really want to do here is that I just want to manipulate the displaying of the From email address header so it will just display as:
From: jdoe@xyz.com
Thanks for any respond.
John
|
|
|
|
|
|
Hi Muhammad,
Can you please give me a little bit more detail?
Thanks,
John
|
|
|
|
|
I am using AllocConsole to add a console window to a window form at runtime but i can't write to it using console.write.
|
|
|
|
|
CiNN wrote: I am using AllocConsole to add a console window to a window form at runtime
Why?
|
|
|
|
|
|
hi all
i save a file in my program in an extension that i made
so i wanna this file to have the icon of my program how can i make it
thanx
Generator
|
|
|
|
|
You can do it manually in many ways:
- through Windows Explorer, Tools, Folder Options, File Types;
- more easily: by double-clicking a file with the new extension; Windows will guide
you through the process.
And you can do it programmatically, it has been described in many CP articles;
search for "File Association".
|
|
|
|
|
|
Hello,
I hope one of you have found a solution to the following problem before. . . Thanks in advance if you have.
I have to implement an interface defined in an external program - I must have a method Notify() in my object
toimplement that interface. When there's an update, the Notify() method is called by the external program. I can
then collect any updates with a method call that returns a System.Array consisting of an ID (given by me when
implementing the connection), and a value.
The problem is that the array that I collect updates from is of fixed size (subsequent updates are not added to
the end of the array like a queue. . ), so sometimes by the time I've collected the update, set a member variable
in another object to the value (m_Object.SomeValue) and returned to respond to any subsequent Notify() calls, the
updates have been overwritten and I've missed some updates. . . Not great. I've removed any calculations I was
doing in these Set() methods, but it still doesn't return in time. .
This is a sample of my set-up:
ManualResetEvent m_NotifyEvent;
Thread m_UpdateThread;
. . . .
m_NotifyEVent = new ManualResetEvent(false);
m_UpdateTHread = new THread(new ThreadStart(RTDUpdates));
m_UpdateThread.Start();
... . .. .
private void RTDUpdates()
{
m_NotifyEVent.WaitONe();
System.Array arrValues = m_RTDServer.RefreshData();
if(arrValues > 0)
{
for (int i =0; i
|
|
|
|
|
You could always store it in a List<...> or ArrayList internally and then just copy it out to an array to return it out.
|
|
|
|
|
tobriain wrote: How can I concentrate on maintaining the proper state of the variables
You mean like making a copy of the Array as your first step?
|
|
|
|
|
Thanks for the swift replies. .
>You mean like making a copy of the Array as your first step?
In any case, processing the updated array, setting the values and returning in time doesn't seem to be working. If I make a copy of the array and return immediately, i'll end up having maybe 10 arrays per second. I need to get the values out of the update array on one thread, maybe, and put them into some kind of dynamic list. Then on another thread, I need to take the values out in order, and set the variables. If that works, although the variables will be set a little bit later than before, they will be set in order, with none of the updates being dropped. How do I go about doing that?
Best regards,
Tom.
|
|
|
|
|
tobriain wrote: How do I go about doing that?
I don't know what you are asking? You have still not supplied a complete description of your Problem/Goal. Surely putting values into member variables is not the end goal of your processing.
|
|
|
|
|
Thanks again for the help.
It's not the end goal, no. I set variables, do some processing and comparisons based on the updates, fir events, update a GUI, save a log etc. Everything after that is working perfectly. Once the variables are set with the updates, my application works as expected. The only problem is that I'm dropping updates. I'm collecting a value from an 'intray' in an external program - an intray that only has space to store one update. I need a thread that does nothing but collect updates, throw them onto a queue and return immediately.
Then I need to nofify a method that updates are on the queue, and get it to remove the updates in order, set variables accordingly and clear the queue. The problem is that I need to do that without 'locking the queue', because then my other thread will not return to collecting data from the external program in time. . . . Any ideas?
Best regards,
Tom.
|
|
|
|
|
Sounds to me like you have a good handle on what you need to do, but are not certain about the details.
What I perceive that you need is this:
1. You need to declare a class available AutoResetEvent.
2. You need to declare a dynamic list of some sort. In this case Queue would work perfectly.
3. You need to set up a thread that runs when this thread becomes signaled.
4. In your notify event handler do two things,
A. Put the incoming data block/message onto the queue.
B. Signal the autoresetevent that there is data to process.
In your data processing thread, make sure that it runs until all items on the queue are processed before returning to wait for the next signal.
As for locking, use a synchronized queue. That way the locking is done for you. If you're worried that locking the queue will cause the notification method to take too long, then you are not using locks properly. You should only lock the queue when you are adding to it or removing from it. Otherwise there should be no need to lock.
Uhm, yeah I spent 6 years dealing with a very similar situation.
Hopefully this helps.
Phil
|
|
|
|
|
Fantastic. Nose to the grindstone now. .
|
|
|
|
|
Phil, I've just one question about your suggestion, and would appreciate you help as you've obviously spent time putting together something robust along the same lines.
At the moment, if I create multiple RTDServers, all the different calls to UpdateNotify() will be on the same thread. Is that correct? Should I thread them out, so that the initial calls can be made on separate threads?
Could I just create a delegate with the same signature as my RTDUpdates method and make a call to BeginInvoke in the UpdateNotify method to queue all the updates on the ThreadPool? (It doesn't matter if the updates are not processed in order). If I do something like that, do I need a dummy EndInvoke to close the AsyncWaitHandle?
When UpdateNotify is called, could I make a call to to a new method (one that calls the RefreshData method) with BeginInvoke, and then set up the RTDUpdates method as the callback method?
I'd appreciate any pointers you could give me on this, as I'm sure some of the above are illadvised for various reasons.
Best regards,
Tom.
|
|
|
|
|
I'm not certain I understand the design of your software system. Please give more specific details such as: Are there one or more executables creating the data that is to be displayed? Are there one or more executables reading and displaying this data? Is there any other processing besides getting the data ready for display?
When updating the UI from a separate thread, one should always use the delegate and begin invoke calls in the UI method for the reason that the UI processing will be done on the UI thread. You don't need to worry about calling the end invoke method, that method is called by the UI thread when it is finished and the clean up will ensue.
As for how to setup the delegates for the UI properly, you can read up on that in your help documentation. Look up the key word "delegates".
Phil
|
|
|
|
|
led mike wrote: I don't know what you are asking? You have still not supplied a complete description of your Problem/Goal. Surely putting values into member variables is not the end goal of your processing.
Thanks again for the help.
It's not the end goal, no. I set variables, do some processing and comparisons based on the updates, fir events, update a GUI, save a log etc. Everything after that is working perfectly. Once the variables are set with the updates, my application works as expected. The only problem is that I'm dropping updates. I'm collecting a value from an 'intray' in an external program - an intray that only has space to store one update. I need a thread that does nothing but collect updates, throw them onto a queue and return immediately.
Then I need to nofify a method that updates are on the queue, and get it to remove the updates in order, set variables accordingly and clear the queue. The problem is that I need to do that without 'locking the queue', because then my other thread will not return to collecting data from the external program in time. . . . Any ideas?
Best regards,
Tom.
|
|
|
|
|
tobriain wrote: Any ideas?
Might be a good time to condsider a Message Queue.
|
|
|
|
|
What does it mean? When are you supposed to use this?
|
|
|
|
|
it is part of an identifier, just like regular letters and digits.
Some people prefix an underscore (or even m_) to indicate a class member,
as opposed to a method's parameters. And lots of people dont like it.
|
|
|
|