Results 1 to 7 of 7

Thread: when and where do we need octal code?

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,070
    Thanks
    95
    Thanked 98 Times in 96 Posts

    Default when and where do we need octal code?

    I think this is the best place for this question. I have used octal code on occasion when nothing else seemed to work, but I am not sure when or why that was.

    In short: when and where is octal code useful? specifically in regards to php users like myself.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Octal? Erm... when you're dealing with data separated at the eight-bit. Notably, *nix usually uses an octal representation for its permissions, where each digit is a bitset of 1 (execute), 2 (write), and 4 (read).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. The Following User Says Thank You to Twey For This Useful Post:

    james438 (09-04-2008)

  4. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,070
    Thanks
    95
    Thanked 98 Times in 96 Posts

    Default

    interesting. I didn't realize that chmod permissions used octal code. Seems obvious now, but I don't really deal with permissions very much.

    The following is just a test for now.

    test
           test
    \040\040\040\040\\040\\040;\\040test
    ������������test
    test

    Code:
                     test
           test
    \040\040\040\040\\040\\040;\\040test]
    ������������test
    test
    dunno what this is, but take a sneak peak at this lil script I wrote
    Code:
    <?php
    $b="�";
    $a=0;
    while ($a<200)
    {$b="$b$a";$b.=";";
    echo"$b$b$b$b=&amp;#0$a;<br>";$b="�";$a++;}
    ?>
    I even ran the above code with 20000 instead of 200 in the while loop for even more interesting results. Becareful though, because if you set it to 20000 as opposed to 200 the file was 1mb in size.

    What did I just write? it doesn't look like octal, binary or even hex to me. I use all three very infrequently, but enough to have some idea of what they look like at least.

    In the tests above I tried typing out & # 0 4 0 ; (without the spaces), but it just came out looking like ( instead. In place of the "�" symbol above I used " & # 0 " (again without spaces).

    I dare not edit this post anymore, because when I do I have to type a bunch of the code out all over again .
    Last edited by james438; 09-04-2008 at 07:30 AM.

  5. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,070
    Thanks
    95
    Thanked 98 Times in 96 Posts

    Default

    Looks like the above is using ascii which I know even less about. The above post was mostly for fun. I was mostly playing around to see if I could get octal code to execute within a post. I remembered someone doing it once before, but it looks like they were posting ascii.

  6. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    'Octal code'... octal isn't code. It's just a way of encoding numbers. In this particular case, you're just using plain old decimal. In HTML, you could also have expressed those numbers as hexadecimal if you so desired (by following the '#' with an 'x').
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #6
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,070
    Thanks
    95
    Thanked 98 Times in 96 Posts

    Default

    my mistake. Thanks for the correction in my syntax. Would I call it octal encoded notation?

    Using the decimal notation (as opposed to octal notation) in Opera I discovered that there is a symbol potentially listed anywhere from 0 to 65535. After that I didn't see anything. Encoded were many different symbols, but mostly letters or characters from many different languages. I know I am talking about 2 different notation types. I am mostly just rambling on a bit as I note my latest discovery of numerical representation of characters.
    Last edited by james438; 09-05-2008 at 07:46 PM.

  8. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It's simply a notation, yes — a way of writing numbers. Some numbers mean things that are most easily visible in octal notation.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •