![]() |
[quote=Mini-Geek;209127]You can do the same thing, but with much less code and more readability, like this:
[code] print OUTFILE $usernameLine.$datetimeLine.$justRead;[/code][/quote] Yeah, I wrote that script a while back, when I was still getting the hang of Perl. Needless to say, my more recent creations are a bit less messy. :smile: When I eventually get around to cleaning up my results-processing suite and integrating it into one software package for public release, I'll probably end up re-doing much of it. |
It's not in an entirely finished state (only works right with purely composite results; a prime will probably have a composite-like output but with PRIME as the residue), but here's a script I wrote to recreate (as best as possible with drawing only from the CandidateTest table; the only thing wrong is that the timestamps show the reservation date, not the finishing date) the completed_tests.log file from the DB. To use it, first export the wanted results (an example SQL query is given that does it for all results in the DB, but you might want to add other limitations e.g. "candidatename like '%*192^%'") to a tab-separated file (MySQL's default) containing, in this order:
CandidateName,TestID,PRPingProgram,Residue,EmailID,UserID,ClientID Then, assuming the script is saved as recover-results.pl and the DB data is in DB-out.txt and you want the output in completed_tests.log, run this: [code]perl recover-results.pl DB-out.txt > completed_tests.log[/code][code]# select CandidateName,TestID,PRPingProgram,Residue,EmailID,UserID,ClientID # from CandidateTest where residue != 'null' order by TestID into outfile 'completed_tests.log'; use POSIX qw(strftime); while (<>) { chomp; ($num, $timestamp, $prog, $res, $email, $user, $client) = split(/\t/); @time = gmtime($timestamp); $timestr = strftime("%Y-%m-%d %H:%M:%S", @time); print "[$timestr GMT] $num received by Email: $email User: $user Client: $client Program: $prog Residue: $res \n"; }[/code] |
[QUOTE=Mini-Geek;211385]It's not in an entirely finished state (only works right with purely composite results; a prime will probably have a composite-like output but with PRIME as the residue), but here's a script I wrote to recreate (as best as possible with drawing only from the CandidateTest table; the only thing wrong is that the timestamps show the reservation date, not the finishing date) the completed_tests.log file from the DB. To use it, first export the wanted results (an example SQL query is given that does it for all results in the DB, but you might want to add other limitations e.g. "candidatename like '%*192^%'") to a tab-separated file (MySQL's default) containing, in this order:
CandidateName,TestID,PRPingProgram,Residue,EmailID,UserID,ClientID Then, assuming the script is saved as recover-results.pl and the DB data is in DB-out.txt and you want the output in completed_tests.log, run this: [code]perl recover-results.pl DB-out.txt > completed_tests.log[/code][code]# select CandidateName,TestID,PRPingProgram,Residue,EmailID,UserID,ClientID # from CandidateTest where residue != 'null' order by TestID into outfile 'completed_tests.log'; use POSIX qw(strftime); while (<>) { chomp; ($num, $timestamp, $prog, $res, $email, $user, $client) = split(/\t/); @time = gmtime($timestamp); $timestr = strftime("%Y-%m-%d %H:%M:%S", @time); print "[$timestr GMT] $num received by Email: $email User: $user Client: $client Program: $prog Residue: $res \n"; }[/code][/QUOTE] Is is possible for a test to have the residue of "PRP" instead of "PRIME". This would happen in the case that phrot was used (non-x86) or an older version or LLR was used without pfgw. If you join with the Candidate table, then the LastUpdateTime would be when the result was finished. You could then use the IsPRP and IsPrime columns instead of looking directly at the residue. |
There is a bug in remove_ks.pl: when the prime file is large, egrep gives the error "Regular expression too big", and the script then wipes the sieve file and the file with ks remaining. This has caused me a big problem on Riesel base 51 because I didn't back up the file of ks remaining. The effort to solve that problem is being "coordinated" in the Bases 33-100 thread.
|
[url]http://www.mersenneforum.org/showthread.php?p=233311#post233311[/url]
[QUOTE=Mini-Geek;233311]The odds of prime spreadsheet is very useful, but when the n (or, to a lesser extent, the k) varies greatly, (as is common in CRUS work, or over large areas of any work) it is hard to choose the right average n to get accurate results. I've made a simple command line Java app that has the same function as the odds of prime spreadsheet, but instead of making you pick the average k and n, it reads each k/n pair and works off of that. It reports relevant numbers for primes and twin primes (not triplet or quadruplet). It is attached as a .jar, along with the source (it's not commented, and it includes some other code unused here, but I figured better messy source than no source :smile:). Run it without any arguments (or with -h or whatever) to get help on how to use it ("java -jar calcPrimes.jar" will do it). Note that it is pretty picky with the sieve depth and sieve file. The sieve depth parser is extremely simple: first replace "G" with 9 zeroes and "T" with 12 zeroes, then use Java's Long.parseLong (e.g. 1.5*10^12, 1.5T, and 15M are all invalid, while 1T, 1500G, and 15000000 are valid). And the sieve file must be in NewPGen format ("k n" on each line) with no header of any sort, just the k and n. This has had very little testing, but I've checked it against the spreadsheet on one file, and the results seems to be accurate.[/QUOTE] [URL="http://www.mersenneforum.org/attachment.php?attachmentid=5799&d=1286977423"]calcPrimes.zip[/URL] |
[QUOTE=Puzzle-Peter;248735]I am not sure about the "algebraic factors" which are mentioned in the software thread though.[/QUOTE]
See this post: [url]http://www.mersenneforum.org/showthread.php?p=248690#post248690[/url] And the script here (also linked up there): [url]http://www.mersenneforum.org/showthread.php?p=209045#post209045[/url] |
[QUOTE=Mini-Geek;248737]See this post:
[URL]http://www.mersenneforum.org/showthread.php?p=248690#post248690[/URL] And the script here (also linked up there): [URL]http://www.mersenneforum.org/showthread.php?p=209045#post209045[/URL][/QUOTE] Wow, that's a quick answer! Thanks! EDIT: is this made for linux? /usr/bin/perl does not sound like windows. EDIT2: srsieve gives warnings for algebraic factors for k=324, 900, 1296, 4356, 5184, 5776, 9409, 11449, 14884. Does that mean I should remove these k's from the sieve file? |
[QUOTE=Puzzle-Peter;248738]EDIT: is this made for linux? /usr/bin/perl does not sound like windows.[/QUOTE]
It was made for Windows, but should also work on Linux with little to no modification. The /usr/bin/perl you mention is something that's usually at the start of all Perl files. If I'm not mistaken, that's for Unix systems to know what binary file to execute the script with. Windows has file association that can take care of that. Of course, you'll need some version of Perl installed to run the script. [QUOTE=Puzzle-Peter;248738]EDIT2: srsieve gives warnings for algebraic factors for k=324, 900, 1296, 4356, 5184, 5776, 9409, 11449, 14884. Does that mean I should remove these k's from the sieve file?[/QUOTE] I think MyDogBuster's answer is correct. I'll also note that the script will remove all numbers that need to be removed, which can include removing entire k's, so that's an easy no-confusing-math way to deal with this. :smile: |
I downloaded and installed strawberryperl for windows. I try to start the script with
hiddenPowers.pl pl_remain.txt sr_228.pfgw and I get Use of uninitialized value in open at C:\...\hiddenPowers.pl line 8 readline() on closed filehandle IN at C:\...\hiddenPowers.pl line 11 What's wrong? |
[QUOTE=Puzzle-Peter;248771]I downloaded and installed strawberryperl for windows. I try to start the script with
hiddenPowers.pl pl_remain.txt sr_228.pfgw and I get Use of uninitialized value in open at C:\...\hiddenPowers.pl line 8 readline() on closed filehandle IN at C:\...\hiddenPowers.pl line 11 What's wrong?[/QUOTE] I'm not entirely sure what the problem is. Does pl_remain.txt exist in the folder you're in (and double check it's spelled/typed right, and isn't really .txt.txt or anything else)? If not, of course, that's your problem; if so, what is your Perl version? Maybe something changed that I need to fix for it to work with the newest versions. The version I've got is v5.10.0. If a solution isn't apparent soon, you can just ignore it like gd_barnes said, since it doesn't make a huge difference, especially when working with small numbers. |
[QUOTE=Mini-Geek;248779]I'm not entirely sure what the problem is. Does pl_remain.txt exist in the folder you're in (and double check it's spelled/typed right, and isn't really .txt.txt or anything else)? If not, of course, that's your problem; if so, what is your Perl version? Maybe something changed that I need to fix for it to work with the newest versions. The version I've got is v5.10.0.
If a solution isn't apparent soon, you can just ignore it like gd_barnes said, since it doesn't make a huge difference, especially when working with small numbers.[/QUOTE] I typed only the first characters and hit tab to auto-complete the file names, so they should be correct. I couldn't see any spelling errors either. My perl version is 5.12.2.0 and I'm running WinXP 32bit. EDIT: I just changed the second and third code line to open(IN, "pl_remain.txt"); $file = "sr_228.pfgw"; and it started working, but every output line telling me which k is worked on is followed by "Removed 0 line(s)" and two "Syntax error" messages. Is abc a valid format for the script? I tried switching to NewPGen format using srfile -g, but I ended up with one file for each k... |
| All times are UTC. The time now is 09:34. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.