I'm reading the PhishTank XML file of active phishing sites,
at "http://data.phishtank.com/data/online-valid/" This changes
frequently, and it's big (about 10MB right now) and on a busy server.
So once in a while I get a bogus copy of the file because the file
was rewritten while being sent by the server.
Any good way to deal with this, short of reading it twice
and comparing?
John Nagle 7 1165
John Nagle schrieb:
I'm reading the PhishTank XML file of active phishing sites,
at "http://data.phishtank.com/data/online-valid/" This changes
frequently, and it's big (about 10MB right now) and on a busy server.
So once in a while I get a bogus copy of the file because the file
was rewritten while being sent by the server.
Any good way to deal with this, short of reading it twice
and comparing?
Make them fix the obvious bug they have would be the best of course.
Apart from that - the only thing you could try is to apply a SAX parser
on the input stream immediatly, so that at least if the XML is non-valid
because of the way they serve it you get to that ASAP. But it will only
shave off a few moments.
Diez
On Jul 16, 1:00 am, John Nagle <na...@animats.comwrote:
I'm reading the PhishTank XML file of active phishing sites,
at "http://data.phishtank.com/data/online-valid/" This changes
frequently, and it's big (about 10MB right now) and on a busy server.
So once in a while I get a bogus copy of the file because the file
was rewritten while being sent by the server.
Any good way to deal with this, short of reading it twice
and comparing?
John Nagle
Sounds like that's the host's problem--they should be using atomic
writes, which is usally done be renaming the new file on top of the
old one. How "bogus" are the bad files? If it's just incomplete,
then since it's XML, it'll be missing the "</output>" and you should
get a parse error if you're using a suitable strict parser. If it's
mixed old data and new data, but still manages to be well-formed XML,
then yes, you'll probably have to read it twice.
-Miles
On 7/16/07, John Nagle <na***@animats.comwrote:
I'm reading the PhishTank XML file of active phishing sites,
at "http://data.phishtank.com/data/online-valid/" This changes
frequently, and it's big (about 10MB right now) and on a busy server.
So once in a while I get a bogus copy of the file because the file
was rewritten while being sent by the server.
Any good way to deal with this, short of reading it twice
and comparing?
If you have:
1. Ball park estimate of the size of XML
2. Some footers or "last tags" in the XML
May be you can use the above to check the xml and catch the "bogus" ones !
cheers,
--
----
Amit Khemka
website: www.onyomo.com
wap-site: www.owap.in
Home Page: www.cse.iitd.ernet.in/~csd00377
Endless the world's turn, endless the sun's Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.
Miles wrote:
On Jul 16, 1:00 am, John Nagle <na...@animats.comwrote:
> I'm reading the PhishTank XML file of active phishing sites, at "http://data.phishtank.com/data/online-valid/" This changes frequently, and it's big (about 10MB right now) and on a busy server. So once in a while I get a bogus copy of the file because the file was rewritten while being sent by the server.
Any good way to deal with this, short of reading it twice and comparing?
John Nagle
Sounds like that's the host's problem--they should be using atomic
writes, which is usally done be renaming the new file on top of the
old one. How "bogus" are the bad files? If it's just incomplete,
then since it's XML, it'll be missing the "</output>" and you should
get a parse error if you're using a suitable strict parser. If it's
mixed old data and new data, but still manages to be well-formed XML,
then yes, you'll probably have to read it twice.
-Miles
Yes, they're updating it non-atomically.
I'm now reading it twice and comparing, which works.
Actually, it's read up to 5 times, until the same contents
appear twice in a row. Two tries usually work, but if the
server is updating, it may require more.
Ugly, and doubles the load on the server, but necessary to
get a consistent copy of the data.
John Nagle
Miles wrote:
On Jul 16, 1:00 am, John Nagle <na...@animats.comwrote:
> I'm reading the PhishTank XML file of active phishing sites, at "http://data.phishtank.com/data/online-valid/" This changes frequently, and it's big (about 10MB right now) and on a busy server. So once in a while I get a bogus copy of the file because the file was rewritten while being sent by the server.
Any good way to deal with this, short of reading it twice and comparing?
John Nagle
Sounds like that's the host's problem--they should be using atomic
writes, which is usally done be renaming the new file on top of the
old one. How "bogus" are the bad files? If it's just incomplete,
then since it's XML, it'll be missing the "</output>" and you should
get a parse error if you're using a suitable strict parser. If it's
mixed old data and new data, but still manages to be well-formed XML,
then yes, you'll probably have to read it twice.
The files don't change much from update to update; typically they
contain about 10,000 entries, and about 5-10 change every hour. So
the odds of getting a seemingly valid XML file with incorrect data
are reasonably good.
John Nagle
John Nagle wrote:
Miles wrote:
>On Jul 16, 1:00 am, John Nagle <na...@animats.comwrote:
>> I'm reading the PhishTank XML file of active phishing sites, at "http://data.phishtank.com/data/online-valid/" This changes frequently, and it's big (about 10MB right now) and on a busy server. So once in a while I get a bogus copy of the file because the file was rewritten while being sent by the server.
Any good way to deal with this, short of reading it twice and comparing?
John Nagle
Sounds like that's the host's problem--they should be using atomic writes, which is usally done be renaming the new file on top of the old one. How "bogus" are the bad files? If it's just incomplete, then since it's XML, it'll be missing the "</output>" and you should get a parse error if you're using a suitable strict parser. If it's mixed old data and new data, but still manages to be well-formed XML, then yes, you'll probably have to read it twice.
The files don't change much from update to update; typically they
contain about 10,000 entries, and about 5-10 change every hour. So
the odds of getting a seemingly valid XML file with incorrect data
are reasonably good.
I'm still left wondering what the hell kind of server process will start
serving one copy of a file and complete the request from another. Oh, well.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
On Tue, 2007-07-17 at 00:47 +0000, John Nagle wrote:
Miles wrote:
On Jul 16, 1:00 am, John Nagle <na...@animats.comwrote:
I'm reading the PhishTank XML file of active phishing sites, at "http://data.phishtank.com/data/online-valid/" This changes frequently, and it's big (about 10MB right now) and on a busy server. So once in a while I get a bogus copy of the file because the file was rewritten while being sent by the server.
Any good way to deal with this, short of reading it twice and comparing?
John Nagle
Sounds like that's the host's problem--they should be using atomic
writes, which is usally done be renaming the new file on top of the
old one. How "bogus" are the bad files? If it's just incomplete,
then since it's XML, it'll be missing the "</output>" and you should
get a parse error if you're using a suitable strict parser. If it's
mixed old data and new data, but still manages to be well-formed XML,
then yes, you'll probably have to read it twice.
The files don't change much from update to update; typically they
contain about 10,000 entries, and about 5-10 change every hour. So
the odds of getting a seemingly valid XML file with incorrect data
are reasonably good.
Does the server return a reliable last-modified timestamp? If yes, you
can do something like this:
prev_last_mod = None
while True:
u = urllib.urlopen(theUrl)
if prev_last_mod==u.headers['last-modified']:
break
prev_last_mod = u.headers['last-modified']
contents = u.read()
u.close()
That way, you only have to re-read the file if it actually changed
according to the time stamp, rather than having to re-read in any case
just to check whether it changed.
HTH,
--
Carsten Haese http://informixdb.sourceforge.net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andres Baravalle |
last post by:
Hi,
I have a problem using a URL fetching algorithm (HTTP 1.0).
To download an image, I used to use this algorithm:
<?php
Header("Content-type: image/gif");
$referer =...
|
by: Jenden0 |
last post by:
I'm new to C# (and Microsoft in general) so this may be a simple
problem, but I haven't been able to figure it out yet.
I've got a database with a number of different tables and I want the
user...
|
by: multicherry |
last post by:
Hi,
Having searched for a way to fetch a window object by name, all I came
across were answers along the line of...
"All you have to do is say windowObj = window.open("blah", "name");"
which...
|
by: MD |
last post by:
When displaying the metadata for our system, takes about 5 seconds to
display
10 results to the browser. The whole process works like this.
1. Call the servlet from the javascript with Dom
var...
|
by: Sandman |
last post by:
So, I have this content management system I've developed myself. The
system has a solid community part where members can register and then
participate in forums, write weblogs and a ton of other...
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first...
|
by: satishr23 |
last post by:
Hi,
I am trying to parse the contents of a PHP page from the web which requires me to authenticate.
I guess the way to do this is to make my program login to the login page,grab the cookie and...
|
by: SunshineInTheRain |
last post by:
I'm trying to modify a long long code within a button click by make the insert/update/delete/select using the same transaction. Purpose is to make sure every operation can be rollback instead of some...
|
by: tokcy |
last post by:
HI every one,
i am using tooltip on click of link and i want like when that tooltip open then background window would be blure().
can anyone help me...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |