Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 9 1 2 3 ... LastLast
Results 1 to 10 of 81
Like Tree1Likes

Thread: Breakdown of data (JavaScript)

  1. #1
    Senior Member
    Join Date
    Jan 2021
    Location
    Santa Barbara, CA, USA
    Posts
    136
    Member #
    62344
    Liked
    1 times

    Question Breakdown of data (JavaScript)

    Im trying to code the complete breakdown of data in JavaScript. So far I have:

    Code:
    window.onload = function() {
        var truthProof = true || false,
            myVar = 0,
            myArray = [0, 1];
        if (truthProof) {
            myVar = Number(truthProof);
        } else {
            console.log("false");
        }
    };
    I'm trying to break an object down to I think the number 1. Anyone have any idea what I'm talking about/understand what I'm saying?

    Thanks

    -- edit --

    I'm elaborating on what I'm talking about with this edit.

    So what I'm going for is something like, ok, so we have say an object, and a function. An object is not a function, but a function is an object. How do I relate all data, so heirarchically, in javascript, is what I'm trying to figure out. So far I have:

    An object is the start of it.
    A function is an object.
    A bigint is a function
    A number is a (small) bigint
    A string is a number (in that number converts to string, but a string is NaN sometimes)
    A boolean is a string (string converts to boolean)
    An array is a boolean (can have a boolean as an array element)
    From this point on, empty arrays would return a 0
    Everything, in the end, due to (true || false) would return a 1

    It's just a sketch but it's a start. Let me know what you think!

    BTW sorry for reposting, this is basically a repost. Tell me if you want me to condense this all into a single post or no (admins). Thanks
    Last edited by Cinder; Mar 06th, 2021 at 09:36 AM. Reason: elaboration

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,966
    Member #
    5580
    Liked
    757 times
    Perl is a rather old scripting language but it is all based on character and file manipulation.

    It can take things like this:

    Code:
    f699fb0290125b418fe03adcba75ce1b81f8b823c2af848367edb225335398a7c48a4c111c500674c36324af7a82ccde667f6a4d5eafd7ff31b0418c42b1f48797b6b75baae73376c535da82e13bbf998b656f032bfba48e90f035305963669773b850abf0d4a82da973a99541d68074f4b981b57ed15822147af95cd2b5306fddc52c81fd2cac1e4ff8e67525cfbbb3f8a62607e94b92daf5e0c730fca06ef6a7a24187a4b53cb5453d4e386c14058ca79123499782594099e89de08ff7c4794f86bd06bd7e28ddd123650df61a5a986eedeea0c2f951981ca517f86c1ad41f82ed9db54a949b86e31699a31855bdf16ca4b716903a36a4da583576ce5a8bd28bae2e5ebf57a7335adf0879be223e7c12ee6f478ca390409e678108373cf2de315fb1f4e4c1dbba4c259a3c3fb50a3b267eeeaf89579b2189c036230d76b541306a8ab9865321bce9b762aba2597bf8a8b75b99b9ce981d313d86e21619655a2870c8f9b1a4f2bc27bbf203c8886fe3c42c61df152d11a9d94d61033e96890bd8b221d6b2c1b4563ada7f7ca05578084099b26c28bb504a5f72c45c11efbe4cd6dc9398293b98693599ea795e659a53096b60f3e1ec6e2c26752dfa7dbd5a71b644c1994653f36522dede41d70a22cdbc623442626958ed6030485d355497314f4100861b3133113c50506fad8569917c964afaf532e19055162782b7e184cd
    And decode to this:

    Code:
    /* Smartphones (portrait and landscape) ----------- */
    @media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
    /* Styles */
    }
    
    /* Smartphones (landscape) ----------- */
    @media only screen and (min-width : 321px) {
    /* Styles */
    }
    
    /* Smartphones (portrait) ----------- */
    @media only screen and (max-width : 320px) {
    /* Styles */
    }
    
    /* iPads (portrait and landscape) ----------- */
    @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
    /* Styles */
    }
    
    /* iPads (landscape) ----------- */
    @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) {
    /* Styles */
    }
    
    /* iPads (portrait) ----------- */
    @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {
    /* Styles */
    }
    /**********
    iPad 3
    **********/
    @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) and (-webkit-min-device-pixel-ratio : 2) {
    /* Styles */
    }
    
    @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio : 2) {
    /* Styles */
    }
    /* Desktops and laptops ----------- */
    @media only screen  and (min-width : 1224px) {
    /* Styles */
    }
    
    /* Large screens ----------- */
    @media only screen  and (min-width : 1824px) {
    /* Styles */
    }
    
    /* iPhone 4 ----------- */
    @media only screen and (min-device-width : 320px) and (max-device-width : 480px) and (orientation : landscape) and (-webkit-min-device-pixel-ratio : 2) {
    /* Styles */
    }
    
    @media only screen and (min-device-width : 320px) and (max-device-width : 480px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio : 2) {
    /* Styles */
    }
    
    /* iPhone 5 ----------- */
    @media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2){
    /* Styles */
    }
    
    @media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2){
    /* Styles */
    }
    
    /* iPhone 6, 7, 8 ----------- */
    @media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2){
    /* Styles */
    }
    
    @media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2){
    /* Styles */
    }
    
    /* iPhone 6+, 7+, 8+ ----------- */
    @media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2){
    /* Styles */
    }
    
    @media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2){
    /* Styles */
    }
    
    /* iPhone X ----------- */
    @media only screen and (min-device-width: 375px) and (max-device-height: 812px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 3){
    /* Styles */
    }
    
    @media only screen and (min-device-width: 375px) and (max-device-height: 812px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 3){
    /* Styles */
    }
    
    /* iPhone XS Max, XR ----------- */
    @media only screen and (min-device-width: 414px) and (max-device-height: 896px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 3){
    /* Styles */
    }
    
    @media only screen and (min-device-width: 414px) and (max-device-height: 896px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 3){
    /* Styles */
    }
    
    /* Samsung Galaxy S3 ----------- */
    @media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2){
    /* Styles */
    }
    
    @media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2){
    /* Styles */
    }
    
    /* Samsung Galaxy S4 ----------- */
    @media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 3){
    /* Styles */
    }
    
    @media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 3){
    /* Styles */
    }
    
    /* Samsung Galaxy S5 ----------- */
    @media only screen and (min-device-width: 360px) and (max-device-height: 640px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 3){
    /* Styles */
    }
    
    @media only screen and (min-device-width: 360px) and (max-device-height: 640px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 3){
    /* Styles */
    }

    PERL ...

    -Option --Default
    db_file <installed source>
    only_complete <false>
    only_iana <false>
    skip_extensions <false>

    my $buf = MIME::Types->new;
    use MIME::Base64 qw(decompress_base64);

    open(FILE, "/html5/compressed/css_media") or die "$!";
    while (read(FILE, $buf, 60*57*1024)) {
    print encode_base64($buf);
    }
    Last edited by mlseim; Mar 06th, 2021 at 02:16 PM.


  4. #3
    Senior Member
    Join Date
    Jan 2021
    Location
    Santa Barbara, CA, USA
    Posts
    136
    Member #
    62344
    Liked
    1 times
    very interesting...

  5. #4
    Senior Member
    Join Date
    Jan 2021
    Location
    Santa Barbara, CA, USA
    Posts
    136
    Member #
    62344
    Liked
    1 times
    Any idea how one goes from a numeric 2 to the string 2? I mean in terms of character encoding logic.

    -- edit --

    The binary value of the numeric 2 is 10, the binary value of the string 2 is 110010. Both have 10 in, where did the 110000 come from is what I'm asking? I'm trying to translate one to the other and back again in like binary logic.

    Like why isn't the binary value of the numeric 2 equal to the binary value of the string 2? I know its because they are of different types, but is there anywhere that elaborates on this a little? I'm trying to figure out how to manually translate the two.

    Like lets say I were to go so far as to map the entire UTF-16 encoding. How would I translate a numeric 2 to a string 2 on the map? Basically, how does something like "String(2);" convert the number to string? Or, when they created UTF-16, how did they decide which characters correspond to which numbers (codes)?
    Last edited by Cinder; Mar 24th, 2021 at 03:21 PM. Reason: more info

  6. #5
    Senior Member
    Join Date
    Jan 2021
    Location
    Santa Barbara, CA, USA
    Posts
    136
    Member #
    62344
    Liked
    1 times
    Ahh rats!

    https://unicode-org.github.io/icu/us...ts-and-unicode:

    "Representing text-format data in computers is a matter of defining a set of characters and assigning each of them a number and a bit representation. Underlying this basic idea are three related concepts:

    1. A character set or repertoire is an unordered collection of characters that can be represented by numeric values."


    There's no logic to it! The sky is falling! Ahhhhh!
    Last edited by Cinder; Mar 25th, 2021 at 08:13 PM. Reason: The sky is falling!

  7. #6
    Senior Member
    Join Date
    Jan 2021
    Location
    Santa Barbara, CA, USA
    Posts
    136
    Member #
    62344
    Liked
    1 times
    Ok I got to work and I figured:

    - The default value of anything is 1 (value = 0 || 1 ? 1 : 0
    - In order to alternate that value one would need to do a sort of binary alternation, a binary subtract/add


    the code for the subtract/add functions is identical except for a single character!

  8. #7
    Senior Member
    Join Date
    Jan 2021
    Location
    Santa Barbara, CA, USA
    Posts
    136
    Member #
    62344
    Liked
    1 times
    I also have figured out that, ok lets say handling the data were something simple like taking in a number and converting to a string and back again, or just plain taking in an array, I have the thing all mocked up, now I just need to reverse-engineer it and get it done

  9. #8
    Senior Member
    Join Date
    Jan 2021
    Location
    Santa Barbara, CA, USA
    Posts
    136
    Member #
    62344
    Liked
    1 times
    Ok so I've been researching and I found that PHP has its DOMDocument class which handles XML and HTML (rather beautifully). So the PHP would shoot off, the HTML would be read and printed and the rest is history.

  10. #9
    Senior Member
    Join Date
    Jan 2021
    Location
    Santa Barbara, CA, USA
    Posts
    136
    Member #
    62344
    Liked
    1 times
    Ok so I figure if I use Boolean to narrow down the search:

    if ((true and false) or (true or false))
    OR
    if ((true and false) AND (true or false))

    therefore I simply get true or false, and from there:

    true or false?

    the answer is true. Correct me if I'm wrong

    Yay!

  11. #10
    Member Cutler's Avatar
    Join Date
    Feb 2021
    Posts
    41
    Member #
    62526
    Liked
    7 times
    You are right. That would result in a TRUE.
    Cinder likes this.
    $1/year Portfolio Hosting with Promo Code: WEBDESIGNFORUMS

    Agency: Marshalled Makers
    Hosting: Marshalled Makers Hosting


Page 1 of 9 1 2 3 ... LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:28 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com