![]() I quickly found the string with my name "KEITH" 65 times. ![]() Yes, this causes some loss of continuity at line breaks, but again, I was willing to live with it. To make the file easy to search, I wrote the resulting text file out in 72 character lines. The next two are 21 returning the letter V.Īt the end of another scriptaculous ruby adventure, I had converted my billion digit file into 500 million letters. The next two digits are 14 also returning O. Adding one to 14 is 15 returning the letter O. 14 divided by 26 is 0 with a modulus (remainder) of 14. Because 26 does not go into 99 evenly, this produces a slight bias against the last few letters of the alphabet but I was will to live with the result.Īs an example, the first two digits are 14. To do this, I added one to the modulus of 26 and each digit pair and indexed it into the alphabet. I decided to use a simpler solution and convert each pair of digits into a letter using the range 1-26. I did get a script working that accomplished this, but the results were not satisfying. That left some 2 digits numbers that had to be scaled up into the useful range and many 3 digit numbers (everything greater than 255) had to be scaled down to the range. To get around this, I decided to only use the part of the table that started with the numbers and went through the end of the lower case letters. To start, many characters in the range from 0-255 are either non-printable or produce symbols or punctuation. This was not very straight forward for several reasons. Mac os ftp command line example code#My first try was an attempt to convert groups of 2 or 3 digits into a character using the ASCII code table. Mac os ftp command line example how to#Having generated a text file with the first billion digits of the square root of 2, I started thinking about how to convert it to text. Print "final roots are " roots.to_s "\n" Print "iteration " iterations.to_s "\n" Root,remainder = newroot(divisor, doubleroot) Multiple1 = (doubleroot.to_s i.to_s).to_i To adjust the precision, change the number of iterations on this line: If you run this Ruby script as is, it will calculate the square root of 2 to 1,000 digits. Eventually, it bogs down because it is doing math with integers hundreds, then thousands of digits long. It produces one (accurate) digit at a time, but the working numbers get larger each iteration. ![]() This is the long hand method I learned in junior high. ![]() There are many numerical methods to calculate square roots. The question is, in the context of a consumer society, can a choice be made without the attachment of social status? The schools you attend, where you work, your clothes, your car, where you live, and yes, your operating system. Whether conscious or not, decisions and choices about purchases you make, where choices are available, weave together part of your social tapestry. In this sense, you are your operating system. A choice to run Linux or other operating system also carries connotations and shared group identity. You can see the social aspect tied to an operating system by looking at the Apple "I'm a Mac" campaign, and the weak Microsoft "I'm a PC" campaign response. I became acutely aware of this after purchasing a car that did not fit my image. Whenever you make a choice among products with similar functions, that choice spills over into the realm of social status.Ĭars are a common example where social rank often goes with brand, and even within brand, by model, and even within model, by variations, upgrades, and badges. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |