mersenneforum.org  

Go Back   mersenneforum.org > Prime Search Projects > Conjectures 'R Us

Reply
 
Thread Tools
Old 2010-03-02, 20:54   #111
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

2×32×353 Posts
Default

Quote:
Originally Posted by henryzz View Post
can you get an accurate enough log of the numbers to sort them by that?
I have an idea as to how I will do it. I just need to see if my idea works. This change would only affect the web pages.
rogue is offline   Reply With Quote
Old 2010-03-02, 23:24   #112
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

10000101010112 Posts
Default

I modified HTMLGenerator.cpp to make it so if you load /all.html or / it will put out all the info from all the pages, in this order:
Code:
PrimesByUser(theSocket);
theSocket->Send("<br>");
UserStats(theSocket);
theSocket->Send("<br>");
PendingTests(theSocket);
theSocket->Send("<br>");
ServerStats(theSocket);
It also has the favicon present, (only in all.html and not in the other pages right now) encoded in the way I suggested way back in this post. As expected, it works without an issue. So I also removed the (already-useless) code that tries to make "favicon.ico" return something useful.
I'd suggest implementing this. (of course with any modifications you think would improve it, e.g. reordering the info)
I tried it out with 3.2.0 and it works just fine (with the PrimesByUser part commented out because it's crashing, but that's fixed in 3.2.1 so you can leave it in).
It is attached.

Why? Just so you can have all the info on one easy link. I've been using a page with a bunch of carefully-sized iframes, but then I realized that it'd be near-trivial to modify the PRPnet server to have a page with all the info in one spot.
Attached Files
File Type: zip HTMLGenerator.zip (1.9 KB, 102 views)

Last fiddled with by Mini-Geek on 2010-03-02 at 23:31
Mini-Geek is offline   Reply With Quote
Old 2010-03-03, 00:39   #113
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

143228 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
I modified HTMLGenerator.cpp to make it so if you load /all.html or / it will put out all the info from all the pages, in this order:
Code:
PrimesByUser(theSocket);
theSocket->Send("<br>");
UserStats(theSocket);
theSocket->Send("<br>");
PendingTests(theSocket);
theSocket->Send("<br>");
ServerStats(theSocket);
It also has the favicon present, (only in all.html and not in the other pages right now) encoded in the way I suggested way back in this post. As expected, it works without an issue. So I also removed the (already-useless) code that tries to make "favicon.ico" return something useful.
I'd suggest implementing this. (of course with any modifications you think would improve it, e.g. reordering the info)
I tried it out with 3.2.0 and it works just fine (with the PrimesByUser part commented out because it's crashing, but that's fixed in 3.2.1 so you can leave it in).
It is attached.

Why? Just so you can have all the info on one easy link. I've been using a page with a bunch of carefully-sized iframes, but then I realized that it'd be near-trivial to modify the PRPnet server to have a page with all the info in one spot.
It didn't appear to unzip correctly. Could you drop the new else if condition inside of a code tag in a response to this post?

Here is the corrected PrimesByUser function:

Code:
void     HTMLGenerator::PrimesByUser(Socket *theSocket)
{
   SQLStatement *sqlStatement;
   int64_t    longDate;
   int32_t    primeCount, showOnWebPage, hiddenCount;
   char       dtString[80], dateReported[20], prevUserID[201];
   char       candidatName[51], userID[201], clientID[201];
   double     decimalLength;
   time_t     theDate;
   struct tm *theTM;

   char       *theSelect = "select UserID, ClientID, CandidateName, " \
                           "       DateReported, DecimalLength, ShowOnWebPage " \
                           "  from UserPrimes " \
                           "order by UserID, DecimalLength; ";

   sqlStatement = new SQLStatement(ip_Log, ip_DBInterface);
   sqlStatement->PrepareSelect(theSelect);
   sqlStatement->BindSelectedColumn(userID, sizeof(userID));
   sqlStatement->BindSelectedColumn(clientID, sizeof(clientID));
   sqlStatement->BindSelectedColumn(candidatName, sizeof(candidatName));
   sqlStatement->BindSelectedColumn(dateReported, sizeof(dateReported));
   sqlStatement->BindSelectedColumn(&decimalLength);
   sqlStatement->BindSelectedColumn(&showOnWebPage);

   theSocket->StartBuffering();

   if (!sqlStatement->FetchRow(false))
      theSocket->Send("<p align=center>No primes found");
   else
   {
      *prevUserID = 0;
      hiddenCount = primeCount = 0;
      do
      {
         if (strcmp(prevUserID, userID))
         {
            if (*prevUserID)
            {
               if (hiddenCount)
                  theSocket->Send("<tr><td align=center colspan=4>User %s has found %d prime%s, %d %s hidden</tr>",
                                  prevUserID, primeCount, ((primeCount>1) ? "s" : ""), hiddenCount, ((hiddenCount>1) ? "are" : "is"));
               else
                  theSocket->Send("<tr><td align=center colspan=4>User %s has found %d prime%s</tr>",
                                  prevUserID, primeCount, ((primeCount>1) ? "s" : ""));
               theSocket->Send("</table><p><p>");
            }

            theSocket->Send("<table frame=box align=center border=1>");
            theSocket->Send("<tr><td align=center colspan=4>Primes and PRPS for User %s</tr>", userID);
            theSocket->Send("<tr><td>Candidate<td>Client<td>Date Reported<td>Decimal Length</tr>");

            strcpy(prevUserID, userID);
            hiddenCount = primeCount = 0;
         }

         primeCount++;
         if (showOnWebPage)
         {
            sscanf(dateReported, "%lld", &longDate);
            theDate = longDate;
            theTM = gmtime(&theDate);
            strftime(dtString, sizeof(dtString), "%c", theTM);
            theSocket->Send("<tr><td align=center>%s<td>%s<td>%s<td align=right>%.0lf</tr>",
                            candidatName, clientID, dtString, decimalLength);
         }
         else
            hiddenCount++;
      } while (sqlStatement->FetchRow(false));

      if (hiddenCount)
         theSocket->Send("<tr><td align=center colspan=4>User %s has found %d prime%s, %d %s hidden</tr>",
                         prevUserID, primeCount, ((primeCount>1) ? "s" : ""), hiddenCount, ((hiddenCount>1) ? "are" : "is"));
      else
         theSocket->Send("<tr><td align=center colspan=4>User %s has found %d prime%s</tr>",
                         prevUserID, primeCount, ((primeCount>1) ? "s" : ""));
      theSocket->Send("</table>");
   }

   theSocket->SendBuffer();

   delete sqlStatement;
}

Last fiddled with by rogue on 2010-03-03 at 00:45
rogue is offline   Reply With Quote
Old 2010-03-03, 02:25   #114
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

10AB16 Posts
Default

Quote:
Originally Posted by rogue View Post
It didn't appear to unzip correctly. Could you drop the new else if condition inside of a code tag in a response to this post?
That's weird. It works for me. Here it is:
Code:
   else if (!strcmp(thePage, "all.html") || !strlen(thePage))
   {
      theSocket->Send("<html><head><title>PRPNet %s Status - %s</title>", PRPNET_VERSION, is_HTMLTitle.c_str());
      theSocket->Send("<link rel=\"icon\" type=\"image\/ico\" href=\"data:image\/ico;base64,AAABAAEAEBAQAAAABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD\/\/wD\/AAAA\/wD\/AP\/\/AAD\/\/\/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD\/\/wAA\/\/8AAP\/\/AAD\/\/wAAva8AAL1vAAC87wAAhCEAALWtAAC1rQAAhCEAAP\/\/AAD\/\/wAA\/\/8AAP\/\/AAD\/\/wAA\">");
      theSocket->Send("</head><body>");

      PrimesByUser(theSocket);
      theSocket->Send("<br>");
      UserStats(theSocket);
      theSocket->Send("<br>");
      PendingTests(theSocket);
      theSocket->Send("<br>");
      ServerStats(theSocket);

      theSocket->Send("</body></html>");
   }
(this can be anywhere in the else if chain, of course, but the " || !strlen(thePage)" should be removed from the other two that have it)
Quote:
Originally Posted by rogue View Post
Here is the corrected PrimesByUser function:
I put your change into my file and it works.

Last fiddled with by Mini-Geek on 2010-03-03 at 02:34
Mini-Geek is offline   Reply With Quote
Old 2010-03-03, 02:55   #115
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

11000110100102 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
That's weird. It works for me.
I put your change into my file and it works.
It did, but I saw a number of compiler warnings of this nature:

warning: unknown escape sequence '\/'

and thought that the zip file might have been corrupted.
rogue is offline   Reply With Quote
Old 2010-03-03, 04:23   #116
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17×251 Posts
Default

Quote:
Originally Posted by rogue View Post
It did, but I saw a number of compiler warnings of this nature:

warning: unknown escape sequence '\/'

and thought that the zip file might have been corrupted.
The forward slashes in the favicon's base64 encoding were escaped. Maybe that wasn't right after all...
I hadn't noticed such a warning, but looking back on the build log I see this repeated several times:

.\HTMLGenerator.cpp(50) : warning C4129: '/' : unrecognized character escape sequence

I know that it still lets the compile finish (naturally, as it is only a warning) and it sends the right thing to the browser, and the browser reads it correctly.

I don't recall exactly why I originally thought forward slashes needed to be escaped, but perhaps it had something to do with "//" being present in the base64 encoding of the image and also the code to mark a comment.

I'll see if they're needed at all...
Nope. Works just fine as plain old "/" without any escaping, and it's smart enough to see that it's not saying "from here to the end is a comment".
And encoding the icon as a gif instead of an ico makes it a great deal smaller, while still working the same. So this line works:
Code:
theSocket->Send("<link rel=\"icon\" type=\"image/gif\" href=\"data:image/gif;base64,R0lGODlhEAAQAIABAAAAAP///yH5BAEAAAEALAAAAAAQABAAQAIijI9pwBDtoJq0Wuue1rmjuFziSB7S2YRc6G1L5qoqWNZIAQA7\">");
Mini-Geek is offline   Reply With Quote
Old 2010-03-03, 13:43   #117
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

18D216 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
The forward slashes in the favicon's base64 encoding were escaped. Maybe that wasn't right after all...
I hadn't noticed such a warning, but looking back on the build log I see this repeated several times:

.\HTMLGenerator.cpp(50) : warning C4129: '/' : unrecognized character escape sequence

I know that it still lets the compile finish (naturally, as it is only a warning) and it sends the right thing to the browser, and the browser reads it correctly.

I don't recall exactly why I originally thought forward slashes needed to be escaped, but perhaps it had something to do with "//" being present in the base64 encoding of the image and also the code to mark a comment.

I'll see if they're needed at all...
Nope. Works just fine as plain old "/" without any escaping, and it's smart enough to see that it's not saying "from here to the end is a comment".
And encoding the icon as a gif instead of an ico makes it a great deal smaller, while still working the same. So this line works:
Code:
theSocket->Send("<link rel=\"icon\" type=\"image/gif\" href=\"data:image/gif;base64,R0lGODlhEAAQAIABAAAAAP///yH5BAEAAAEALAAAAAAQABAAQAIijI9pwBDtoJq0Wuue1rmjuFziSB7S2YRc6G1L5qoqWNZIAQA7\">");
Much better. No warnings of any kind.
rogue is offline   Reply With Quote
Old 2010-03-04, 14:16   #118
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

2·32·353 Posts
Default PRPNet 3.2.1 has been released

I have put an alpha for 3.2.1 here:

http://home.roadrunner.com/~mrodenki...pnet_3.2.1.zip

I have not gone through any of the heavy duty testing for NPLB, but there are enough other improvements that people have been waiting for. Here is a summary of the changes:

All executables:
  • Added memory leak detection logic (Windows only) and fixed numerous memory leaks.
  • Fixed a number of memory leaks.
  • Changed sockets to include TCP_NODELAY setting.
  • Changed "char *fmt" to "const char *fmt" to eliminate a number of compiler warnings.

Client only:
  • Accept "keepalive" message from server when getting work.
  • Modify so that client can connect to a server that needs a non-blocking or blocking socket.

Server only:
  • Fixed two crashes, one with webpage generation and one with unhiding primes.
  • Fixed an issue with the display of Fixed K/B/C server stats.
  • Send "keepalive" to client when opening work work cursor so that client doesn't time out.
  • Fixed ordering of k on server_stats.html
  • Added all.html as the default webpage.

I will change this to a beta as soon as I do the testing for NPLB.
rogue is offline   Reply With Quote
Old 2010-03-04, 14:32   #119
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

10000101010112 Posts
Default

(tested with resuming from 3.2.0 files)
The client no longer detects that base 16 work (I'm guessing it's like that for all power-of-2 bases, maybe even including base 2, but have not tested this) should be sent to LLR instead of PFGW. Because of this, I've reverted my clients to 3.2.0 for now.
e.g. with this as the work_servername.in file:
Code:
ABC $a*$b^$c+1
31347 16 200799
I haven't seen any problems yet with the server.

Last fiddled with by Mini-Geek on 2010-03-04 at 14:36
Mini-Geek is offline   Reply With Quote
Old 2010-03-04, 14:47   #120
Lennart
 
Lennart's Avatar
 
"Lennart"
Jun 2007

25×5×7 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
(tested with resuming from 3.2.0 files)
The client no longer detects that base 16 work (I'm guessing it's like that for all power-of-2 bases, maybe even including base 2, but have not tested this) should be sent to LLR instead of PFGW. Because of this, I've reverted my clients to 3.2.0 for now.
e.g. with this as the work_servername.in file:
Code:
ABC $a*$b^$c+1
31347 16 200799
I haven't seen any problems yet with the server.
I run k*2^n+1 and the client use pfgw ??

Lennart

EDIT: This is on both Linux and Windows.

Last fiddled with by Lennart on 2010-03-04 at 15:14
Lennart is offline   Reply With Quote
Old 2010-03-04, 15:04   #121
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17×251 Posts
Default

history.txt says 3.2.1 was released Februrary 2011. I think you mean March 2010.
Mini-Geek is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
PRPNet 5.4.3 Released rogue Software 178 2021-06-24 11:56
PSP goes prpnet ltd Prime Sierpinski Project 86 2012-06-06 02:30
PRPNet 4.0.0 Released rogue Software 84 2011-11-16 21:20
PRPNet 4.0.1 Released Joe O Sierpinski/Riesel Base 5 1 2010-10-22 20:11
PRPNet released! rogue Conjectures 'R Us 250 2009-12-27 21:29

All times are UTC. The time now is 12:10.


Mon Aug 2 12:10:22 UTC 2021 up 10 days, 6:39, 0 users, load averages: 1.40, 1.58, 1.49

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.