excaliber[Free-DC.org] 2003-12-15 12:52:17 | I'm working on our team strain repository, and am running into issues regarding the results.dat. Currently, the file is uploaded to a temp file server side. The contents are read into one long long string. It is then exploded (PHP function for splitting a string into an array, based on a delmiter provded). Im exploding it by using a character 13 followed by a character 10 (Carriage return Line feed). It works the majority of the time, but everyonce in a while, I get a result like the following: quote: Which apparently is not ended with a CrLf between the and the Is this a problem on my end or yours? Should I explode by something else? Would you recommend another way of dividing the lines into something suitable for database submission? Thanks EDIT: There are also instances in my results.dat where a line of data is given right after another line of data, without the normal stats and such. Like below: quote: ------------------ http://intheory.ath.cx InTheory - Game Design and Idea discussion forum [This message was edited by excaliber[Free-DC.org] on 2003-Dec-15 at 22:05.] |
[DPC]Stephan202 2003-12-15 13:06:59 | The reason for these errors is simple: Some people are submitting a results.txt or results.dat with errors. I have made a system similary to yours once (see http://stephan202.qik.nl/), and I had some code to pick out files with an error. I can't recall how I did it. If you want the code, then I'll give it tomorrow - I'm going to bed in a sec. As for the splitting: I used file(), which reads an entire file into an array, each line on a separate index. That works just as well, and even works if people submit files with only \n's (like in unix). --- Dutch Power Cow. MOOH! |
excaliber[Free-DC.org] 2003-12-15 14:07:19 | Thanks, I'd love to see how you spotted bad files. I'll start using File(). Its sounds much simpler than my current method, and does the same in less. Less = less errors I figured it was on my end. I think it stemmed from when I first started the script. About a day later, I noticed it was uploading correctly, but the download script was not formatting correctly. I think this is where the errors were introduced, and have just propagated to make my life worse. ------------------ http://intheory.ath.cx InTheory - Game Design and Idea discussion forum |
Herb[Romulus2] 2003-12-15 22:33:13 | I just separate the lines with DOS commands, the result is always proper to import elsewhere type results.dat | find "tantal" > par.txt type results.dat | find "solenoid" > val.txt ------------------------------- I'd say more, but I can't reach the keyboard from the floor. |
Stephen Brooks 2003-12-16 03:40:00 | quote:Reminds me of the situation I had with the stats database about 18 months ago... Having one of those "double lines" caused by a cut and paste error would cause half of someone's file to be deleted. Now I just have it skip over the unwanted second-of-the-same-type line, which later gets removed. HB Pencils, also sold as "Moron's Choice" Graphite Cigars. |
[DPC]Stephan202 2003-12-16 09:34:30 | I temporarely placed the source of the update code of my scrip at http://home.planet.nl/~schro393/dpad.zip This does not include the front end - I can't find it anywhere. The code is a little chaotic perhaps, and the commenst are in Dutch. I don't think it'll be very useful, but it may help, so there it is. --- Dutch Power Cow. MOOH! |