You are here: Re: Reading Binary Files « PHP Programming Language « IT news, forums, messages
Re: Reading Binary Files

Posted by Mazin07 on 09/20/05 21:00

Steve wrote:
>>Just compress the file with the zlib functions. The compression routine
>>will squeeze out most of the redundancy.
>
>
> OT: Chung, I was about to tell you off for suggesting that an
> irrational number like PI could be compressed but... luckily I paused
> for a moment, and googled this
> <http://thestarman.dan123.com/math/pi/picalcs.htm> that shows better
> than 50% compression rates. So that told me.
>
> Back to the OP, where you go from here depends entirely on what your
> search algorithm is doing at the moment with the string version of PI.
> If it is a brute force dumb search, it will not need much modification
> but it will be slow.
>
> You need to pack the search substring first in the same way as your PI
> digits. You probably have to do a minimum of two searches: one to look
> for odd-aligned substrings and one to look for even-aligned substrings.
> Doing a search with a substring starting or ending on an odd-aligned
> digit also means managing the "don't care" digits. You might be able to
> devise a suitable regexp to handle all of this. Best of luck. Can you
> tell me if my birthday is in there (19590318)?
>
> ---
> Steve
>

I haven't tried it yet, but I was figuring I could maybe unpack the
whole thing or partrs of it at a time into hex and then search it from
there.

BTW: 19590318 isn't in the first 8 million digits.
I guess you could try (the slow one) for yourself.
http://ericjiang.co.nr/pi.php

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация