Wikipedia:Reference desk/Archives/Computing/2017 February 19

= February 19 =

Lost Contents
As I was using MS Word, I accidentally deleted the contents than saved the document. I realised this thereafter reviewing the document. How do I re-collect the information? 103.67.159.200 (talk) 04:36, 19 February 2017 (UTC)
 * Apparently there is a "redo" button. 80.5.88.48 (talk) 09:17, 19 February 2017 (UTC)


 * Guess "undo" was meant. Only if the Word-session is still open you can try to undo (Ctrl-Z) the deletion and hit save again. Once MS-word is closed, the undo-memory is lost.
 * If that doesn't work, look in the folder containing the original document for one of those automatic backup files MS-word makes.
 * Also, you may have a backup of your original file. If not, start to backup your work from now on. Jahoe (talk) 12:07, 19 February 2017 (UTC)


 * This happens quite regularly where I work (a school) and it is the teachers who usually lose their work. We drum into them, as soon as you've opened a new MS Office document, save it immediately and then carry on working. The autosave means they have a good chance of recovering their work, but only if they have saved it once. --TrogWoolley (talk) 13:09, 19 February 2017 (UTC)
 * Working in coding and drafting (two fields that produce digital files as an end product), I've always been meticulous about versioning. That is each day, I save a new copy of the file I'm working on. That way I get to keep a series of autosaves, plus distinct daily versions (not to mention the version in the file server backups). End result: no matter what happens (short of a massive EMP) you'll never lose more than a few hours of work, and usually less than a few minutes. This is one of those problems that can't really be solved, only prevented. Sorry, but the best thing you can do now is not let this happen again. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  21:37, 20 February 2017 (UTC)

Lists of large safe primes?
I'm looking for some safe primes of around 300 or so digits. Is there a standard listing of that sort of thing? I did take a stab at generating them using a fairly efficient computing algorithm - which does fine in the tens of digits - but of course a jump in order of magnitude just creates such a much larger search space that I've yet to see a single prime of that size at this point. Any ideas? Earl of Arundel (talk) 08:30, 19 February 2017 (UTC)
 * It should be pretty easy to generate safe primes using the OpenSSL library. Here's a program which claims to do that, although I haven't verified whether it works as advertised.  If you're using primes for cryptographic purposes where the primes need to be kept secret, you will of course want to generate your own primes and not rely on any published list of primes, since an attacker would have access to such published lists. CodeTalker (talk) 17:16, 19 February 2017 (UTC)
 * Thanks, I'll give that a go. On a side note, one of the two programs I've been running did produce a safe prime overnight:

 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222801407
 * That was generated by sequential search. The randomized algorithm is still trying to find its first! I actually expected the latter one to locate primes fastest (as the article on generating primes for one suggests). Then again, the randomization routine does impart a bit more overhead than a simple increment, not to mention that a measure of luck is involved with purely random samples. Earl of Arundel (talk) 18:52, 19 February 2017 (UTC)


 * Funny, just minutes after I posted that the randomized algorithm produced this one:

 681585627032540283407897049573943438864991564384081864606798355681927368882418588940610880082924107725344352426869730927204896839743453854437265009790110718860756175638300841264131752404495959142547366913702122243460812876710321117513484795819233714299670604738148021754597371318698761395812018572519
 * At this rate, I just might have a few more primes to work with by the end of the day! We'll see... Earl of Arundel (talk) 19:32, 19 February 2017 (UTC)
 * Many math programs can easily handle this size. Below is a simple PARI/GP line which took 2 GHz hours. It could be more efficient by trial factoring both p and (p-1)/2 before prp testing.  and   make prp tests almost certain to produce primes.   would make primality proofs but be slower. PrimeHunter (talk) 23:00, 19 February 2017 (UTC)

 for(n=1,5000,p=nextprime(random(10^300));if(ispseudoprime((p-1)/2),print(p))) 146826802325178743666647061779713417611259934811900522577544206839763515828687825279365134210939056543140136635939259809100232274940676856687607875001704527141790658441630421867014340205717004954887742192841795596397643359593336357804864669571879248567500042385640119936769305112452232482315185400627 189245147177606331584023875953267114326398737777762360150885641279051616456892584088107824699894789233671588064860339727298515859969383896839558666217153218476356205131691803322265876463410618767738035270628788079093798634481718643230178954554082043541820540195807474059566449769729300898569439347219 906746488931122279923087816774254262549325961021203686871024593960273364483640837461275651353839912478276312989231907136777434371442297783809058139703704548112582549231057887119837609961275494698594028464424938139236812786325180573685365716054578878269276609138278646089652565880503149299047623725983 935963679945159621618108135650731602316123462844739918966791054002220621454733515962631838558167071714943415781502503512108093455147689164719674990397035764248808486754562236727013255473894080575022971540677037449750273014794528407667454650131576454015775014701175216242011377646611112897139737772263 900868433651123753195857434154886592863492075718887214387046829406809805283361296277175990663685161530183997243896077623165157756007099732429029873106259069821886766195661979481563101826429797570890866473513531898785774896418926615059720815237664116812063491035355207065882456370964859448027182804663 78051553050775412450764922949272607832888279795219210490159546292573544344409789339902163711499864234225334440363474968206590948838140508077711461378723988713387646192208969558413389127673105435094693170772364285590152222728794669485480277618571809396011062579114664522387048289471601386870869721619
 * Ah, so I could simply have PARI/GP first generate a list of suitable Sophie-Germain/safe-prime pseudoprimes pairs and then pass those to the more expensive  function to prove their primality. Nice. Well thank you very much, PrimeHunter! Earl of Arundel (talk) 18:27, 20 February 2017 (UTC)
 * Update: PARI/GP does in fact seem perfect for this task: I have both randomized and sequential search routines implemented which are already pushing out proven safe primes. I was also able to verify that the examples you'd provided are indeed safe primes as well, and very quickly at that (less than a minute for all six of them!). So again, many thanks for the suggestion. Earl of Arundel (talk) 20:25, 20 February 2017 (UTC)

Last bullet in list different color
So I'm trying to figure out the bug in this code:

The blue part, when there are multiple bullet entries, all the bullets are blue except the last one, which is black. The text remains blue though. Stumped as to why. RegistryKey(RegEdit) 14:43, 19 February 2017 (UTC)


 * I suggest you try it in different browsers, to determine if it's just be a bug in the browser you are using. StuRat (talk) 17:59, 19 February 2017 (UTC)
 * StuRat I checked it on Internet Explorer and Chrome, still same issue. RegistryKey(RegEdit) 01:10, 20 February 2017 (UTC)

How's PHP run?
When you have something like  in a file and an Apache2 server running, what runs this bit? There's no PHP process running in the server. Does Apache starts a PHP process, runs the bit, and close it each and every time someone hits the page? --123abcnewnoob (talk) 15:46, 19 February 2017 (UTC)
 * It starts PHP for each request. PHP is programmed to only look for the bits delimited by  and echo the rest verbatim. In FastCGI mode, however, to avoid process spawning overhead, there's one PHP process sitting in memory that may handle many requests over its lifetime. Alternatively Apache may pass the PHP to mod_php which is its in-process PHP interpreter. Asmrulz (talk) 16:02, 19 February 2017 (UTC)