Portal Home > Knowledgebase > Articles Database > Update Data in Real Time from Text File.


Update Data in Real Time from Text File.




Posted by RivaCom, 10-09-2012, 01:57 PM
So I figured I'd ask here so I don't reinvent the wheel. My overall goal is to take a TxT file or other similar files(csv, xml, etc) and take new data and update a webpage with the data. So here are the steps to get from point A. to Point B. and I'm trying to keep it in the php/javascript realm of things. There are multiple static locations of TxT files on different users computers. I can not change where they are saved. I would like to somehow take those file and copy them in realtime a remote server location.Once the file is in the remote location, it should be getting new lines to it multiple times a second. So I need to somehow update a webpage in real time with the data from that text file.Each line of data is going to be part of calculation. So I need to be able to take each line, parse the data, calculate the results and update the webpage with the results. I'm assuming Ajax/Jquery will be my best bet. But not quite sure where to start.

Posted by zoid, 10-09-2012, 02:23 PM
Are we talking about a local network or a distributed system? Also what platform, Unix or Windows?

Posted by RivaCom, 10-09-2012, 02:47 PM
The logs are generated from a application on a windows PC, Dumped into a folder. Now I'm trying to update the data on the webserver. Windows PC(Logs are Created) ->Internet->Webserver(Logs are parsed and data updated) -> User able to view live data on website. I'm not super concerned about getting the file to the webserver, I'm sure it wouldn't be hard to find/write something to copy the file every x second. But where to start on taking that data and putting it in real time on a page.

Posted by zoid, 10-09-2012, 02:51 PM
Could you dump the data in a database and poll it regularly from your site via Ajax?

Posted by RivaCom, 10-09-2012, 03:59 PM
That would actually be fine with me. So I guess I have I have 3 stages. Figure out how to send the Text File data in Real Time to a MySQL DatabaseTake the Raw data from the MySQL Database and move it into the live dataTake the Live Data and update the webpage in Real Time(or close to it)

Posted by iTom, 10-09-2012, 04:42 PM
I would certainly look at using a database, will make your file so much easier. If you start getting massive amounts of data you might also want to look at something like a job queue. Recently worked on a project where we used beanstalkd to temporarily buffer information for 'processing' as we were doing far too many database reads/writes for it to remain scalable, final solution worked really well



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.