473,624 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a good way to implement file updating? such as lock, update,reload.. .

Hello -

My script use a DB file which is written by XML, and the user load
this DB file (XML tree in memory), and then do some updating about
this tree, such as delete element, generate new element or move
element.

The thing is, my script is a cmd based program (based on module
"cmd"), and there are many users would use this script at same time,
in a shell style prompt (module "cmd"), so I want to implement a
updating after a user update the XML tree, it such as a "signal
console", so that all the user can keep same DB, or other user can
see update a few seconds later.

What I did is, create a new file calling "db_change" , and put a number
"1" in file, and then update the real "DB" file (by change uid to lock
file), other user to check this file and then re-load XML file, but I
do not think it is a good idea, the performance is not good.

I would like to know if you could help on this matter, I hope I can
get inspiration/example from you guys.

Thanks,
Jul 7 '08 #1
3 1285
Evan wrote:
Hello -

My script use a DB file which is written by XML, and the user load
this DB file (XML tree in memory), and then do some updating about
this tree, such as delete element, generate new element or move
element.

The thing is, my script is a cmd based program (based on module
"cmd"), and there are many users would use this script at same time,
in a shell style prompt (module "cmd"), so I want to implement a
updating after a user update the XML tree, it such as a "signal
console", so that all the user can keep same DB, or other user can
see update a few seconds later.

What I did is, create a new file calling "db_change" , and put a number
"1" in file, and then update the real "DB" file (by change uid to lock
file), other user to check this file and then re-load XML file, but I
do not think it is a good idea, the performance is not good.

I would like to know if you could help on this matter, I hope I can
get inspiration/example from you guys.
Start using a proper database. And get rid of the XML. If you need it for
output/exchange purposes, generate it from the DB.

Diez
Jul 7 '08 #2
If I get rid of the XML, I have to change my script more and more, it
is not easy to do that. :( :(

Thanks,
Jul 7 '08 #3
Evan wrote:
If I get rid of the XML, I have to change my script more and more, it
is not easy to do that. :( :(

Thanks,
It is even harder to write a multi-user XML database (which is what you are
wanting). Put the data in a multi-user database and convert to XML as needed.

-Larry
Jul 7 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7881
by: writeson | last post by:
Hi all, I've got a PHP program that I've added flock() to in order to protect multiple scripts trying to write to the same file. After I added the flock() to the code the performance of the code went way down. Can anyone tell me if calling flock() on a file handle is particularly slow? Thanks, Doug
3
1720
by: nathan | last post by:
I've got a page with DB data displayed, and a link beside each record to update the corresponding record. When the update icon is clicked, a popup with the data comes up, once the user is finished updating, when they click submit, I have the following code: <input type="button" onClick="opener.location.reload(); self.close()" value="Refresh and close"> My problem with this is that it refreshed the parent too quickly for the data to...
7
1849
by: Menon | last post by:
Hi folks First time posting -if this is not the correct forum, please let me know. For updating a LOB in Oracle (using JDBC), you need to lock the row. Is it true in DB2? How Are LOBs implemented in DB2 - Do you have a locator and contents separated? Thanx.
4
4012
by: Peter Lin | last post by:
Dear all; I need to monitor a xml file so that I can update my data in hashtable, but the problem is it will trigger more than one event for a lastwrite action(I trigger this action by add something in the xml file using notepad). Here is my codes about using FilesystemWatcher fileWatcher=new FileSystemWatcher(); fileWatcher.Path=System.Environment.CurrentDirectory; fileWatcher.NotifyFilter=NotifyFilters.LastWrite;
9
5811
by: Jervin Justin | last post by:
Hi, I've been having this problem for some time with Web Forms: I have a web app that sends data to a service when the user presses a button. Based on the data, the server will send several replies. Since there is no way for a service to post to a client, I am using a thread on the client that polls the server for updates. (Feel free to recommend changes to that as well)
6
4067
by: muttu2244 | last post by:
hi all am updating the same file in ftp, through multiple clients, but am scared that two clients may open the same file at a time, and try updating, then the data updated by one data will be lost. So i have to provide some lock mechanism to that file in ftp, so how can i lock it, if one client opens it for updating, so that till it gets relased it cannot be updated by other clients. Could u please suggest me the simple solutions...
54
3614
by: sam.s.kong | last post by:
Hi! I've been programming ASP for 5 years and am now learning PHP. In ASP, you can use GetRows function which returns 2 by 2 array of Recordset. Actually, it's a recommended way in ASP when you access DB as it disconnects the DB earlier. Also, it's handy as you can directly access any data in the array without looping.
3
10395
by: dchadha | last post by:
Hi, I am working on application in C# which uses and stores data in xml file. This app can use xml file from two different ways: (a) From User Interface (Windows application) and (b) From Windows Service. Both apps read data from xml file in dataset and update the file after doing the desired operation on dataset. Now the problem is when windows service reads the xml in dataset and while its doing the operation (it takes few minutes)...
2
4695
by: archana | last post by:
Hi all, I am having application wherein i am using asynchronous programming and using callback i am updating one label control. My question is can i use lock statment to lock control. If yes which one is better to prevent unpredictable update of label. Whether should i use lock statement or control.invoke and give method name. Please correct me if i am wrong.
0
8238
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8174
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8624
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7164
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.