thenetfreaker has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Hash confusion ?!
by shmem (Chancellor) on Feb 24, 2007 at 19:46 UTC
    I'm working on a De/Coder which can compress 365766! (in factorial) bytes into 9.5Mb of TXT or 1.7Mb of ZIP. The compression (that has been tested so far limits the INPUT length to 60961 bytes); though the OUTPUT is twisted... Laught as much as you want, but i took the Torah {encoding: Hebrew(windows-1255)} which length is 304805 letters what's strange that this huge number equals only to 60961*5 and doesn't devide by 15,25,35,etc. I entered the Torah into a hash which contains the following about each letter : ord(Letter), Original_id, Current_id, my_gimatria_value <=> (ord(letter) -224), colour according to the book( one of five), place in the "pipe of letters", is_occupied. Afterwards i read input into the "pipe" by the only 3 rules( yet) that the current_id changes(as if there's a hole in the "pipe") to counter(from 0) multiplied on 6 AND is_occupie = true AND place = 6 , when finished, it remembers the state in which the torah is twisted into a file names filename.tX. The decoder is the problemetic part although it should be the reverse of the encoder which means rewriting the Coder "backwars".

    See I know what I mean. Why don't you?

    ...to which I want to add:

    • the OP raises far more questions in the reader than are present in the writer (if the writer's question is even visible).

    Questions your post rises:

    • What do you ask for? a code revision?
    • did you calculate the factorial of 365766?
      The biggest factorial my computer can calculate is 170! = 7,25741e+306, 171! is inf.
    • compared to the former factorial, what is "huge" in the number 304805?
    • to what purpose did you enter the Torah code into a hash?
    • what is Current_id?
    • what purpose does my_gimatria_value have?
    • what colour are you talking about, and according to what book?
    • what is the "pipe of letters" ?
    • into what "pipe" are you reading what "input" afterwards?
    • how do you determine is_occupied?
    • what is "the state in which the torah is twisted"?
    • ... ?

    Then you provide some code which I just gazed at without capacity left to understand it, being busy puzzled by the questions I laid out above. Even trying hard, I had to give up. This puzzle is beyond my skills, although it sounds interesting (maybe related with numerology?).

    I cannot relate all this with the title "hash confusion", given my own. Please reformulate your question and give us more insight into your proceedings.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: Hash confusion ?!
by Joost (Canon) on Feb 24, 2007 at 20:08 UTC
    I'm working on a De/Coder which can compress 365766! (in factorial) bytes into 9.5Mb of TXT or 1.7Mb of ZIP.
    Your definition of factorial is probably different from the normal one. According to wikipedia, 25206! bytes is roughly 1.205703438... *10100,000 bytes, or about 1099,991 Terabyte. A quick google search indicates that there are only 8.87 * 1049 atoms in the whole earth. Your number is ridiculous amounts of orders of magnitude higher.
    The compression (that has been tested so far limits the INPUT length to 60961 bytes);
    Which I can't help but notice is a bit smaller.

    Laught as much as you want, but i took the Torah {encoding: Hebrew(windows-1255)} which length is 304805 letters what's strange that this huge number equals only to 60961*5 and doesn't devide by 15,25,35,etc.
    So what? Why do you think it should be a "factorial" number. Wait never mind, don't answer that.

    p.s.: the "pipe" is a 5 cornered star shaped tunel of letters where on the pics of the start the letters are shifted and in the center the are being written.
    Does this post have anything to do with TIMECUBE? ;-)
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Hash confusion ?!
by graff (Chancellor) on Feb 25, 2007 at 00:13 UTC
    Posting a huge amount of code like that is completely useless for all concerned, when you don't provide any sample data, and don't give us a clear idea of how the actual output differs from the intended output.

    I'm able to tell that there are no syntax errors or compile-time warnings in your program, and I can see that it requires two input files, but I don't happen to have a file called "torah.cod" on my system, and there's no clue about what needs to be in a file called "temp.txt", so there's not much more I can do for you.

    Maybe you could reduce the code to a shorter version that can demonstrate the problem, and post that along with just enough sample data so we can run it and see what the problem is.

    You do seem to be doing some simple things in very complicated, bizarre ways, as in this part of the "enc()" sub that reads from "temp.txt" (I fixed the indenting a bit):

    open (DAT, "$file") || die "$!\n"; while (<DAT>) { seek(DAT, $cc, 0); read(DAT, $tmpR, 1); $tmpR = sprintf("%02x", ord($tmpR)); my @lets = split(//, $tmpR); $data = process($lets[0]); $data = process($lets[1]); print hex($lets[1].$lets[0])." KEY\n"; $cc++; } close(DAT);
    This reads a line of data from the file, then seeks to a byte offset that starts at 0 and increments on each iteration. Then, having done that seek, read one byte, and end up with two characters (in @lets) that are the hex digits for the high and low nibbles of the single byte you've just read, process those two letters, then do another full-line read (which starts at the byte following the one returned by "read(...)".

    Okay, in some sense that actually does work. But what a lot of confusion and extra effort -- it ends up as one iteration of the while loop for every byte in the file, and the number of times each byte is read from the file is equal to the average line length times 2 -- when you really just need to read the data once, like this:

    while (<DATA>) { for my $char ( split // ) { my @lets = split //, sprintf("%02x",ord($char)); process( $_ ) for ( @lets ); print ord( $char ), " KEY\n"; } }
    I'm still puzzled why you bother assigning the return value from the "process()" sub to $data, but never use it for anything. BTW, in order for  hex($lets[1].$lets[0]) to equal  ord($char) -- which I assume is your intention -- you must be on a little-endian machine. Keep that in mind if you try to make this portable. (Update: Sorry, there's no way that hex($let[1].$let[0]) can be equal to ord($char), so either you code has it wrong, or else I'm just not able to understand why you wanted to print the values that way.)

    There's probably a lot more confusion in the OP code, and it's not just a matter of hashes. Good luck -- if you can put together a coherent question, try posting that as a reply in this thread (or start a new thread), then maybe someone here can help.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Hash confusion ?!
by cLive ;-) (Prior) on Feb 24, 2007 at 18:29 UTC
    Err, I think you mis-spelt the word gibberish in your title...
      which one ?
        which one ?

        All those that made us think you may want to ponder what Homer did:

        Man, this is crazy. I hope I didn't brain my damage.