1. Welcome to Smogon! Check out the Smogon Starters Hangout for everything you need to know about starting out in the community. Don't forget to introduce yourself in the Introduction and Hangout Thread, too!
  2. Welcome to Smogon Forums! Please take a minute to read the rules.

Programming GP diff app! :D Now commentable!

Discussion in 'Technical Projects' started by sandshrewz, Dec 12, 2013.

  1. sandshrewz

    sandshrewz POTATO
    is a Site Staff Alumnusis an Artist Alumnusis a Forum Moderator Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis a Battle Server Moderator Alumnus

    Joined:
    Oct 18, 2010
    Messages:
    2,452
    Original by Sarenji. Diff code by Google.

    GP diff app! :D

    This was a very lazy app to serve a very lazy purpose hehe. Anyway, this is basically the same as the old diff app but improved. It uses efficiency cleanup as the one I made previously -- it just means it screws up less lol. BUTTTTTT the best thing is you can now add comments to it!

    Escape comments using !@comments go here@! :D

    For example, original sentence "This is old diff app!" and the new one is "This is a new !@no it's new and dun be lazy!! :O@! diff app!" and the output would be "This is olda new no it's new and dun be lazy!! :O diff app!"

    Also explained some stuff in this post about the edit cost and timeout. You can usally stick to just 3 edit costs and 1 timeout. For longer checks you can increase the timeout to be greater by like a bit. Try not to exceed 10??? If it's super long you can put timeout to 0 and it might freeze your browser for awhile to diff the thing.

    And if you want colors added to the options post in this thread and let me know. As long as the color is reasonable and isn't eye blinding or anything I'll add it. oh and comments are black + bold by default. oh and the red green diff you preview doesn't have comments there.

    Enjoy! :)

    TODO:
    - reduce chance of comments causing diff to screw up. done
    Last edited: Dec 14, 2013
    Rohail, NixHex and Hollywood like this.
  2. Kingler12345

    Kingler12345 COOKIE COOKIE COOKIE STARTS WITH C
    is a Contributor to Smogon

    Joined:
    May 26, 2013
    Messages:
    1,365
    The new version of the diff app kinda screwed up for me as for long gp checks it basically does
    What diff does is
    Is that fixed in the new diff? Thanks. (Btw, all the parameters were default in this; also only happens for long checks)
  3. sandshrewz

    sandshrewz POTATO
    is a Site Staff Alumnusis an Artist Alumnusis a Forum Moderator Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis a Battle Server Moderator Alumnus

    Joined:
    Oct 18, 2010
    Messages:
    2,452
    It depends on which diff you were using. If you were using the one that didn't have the edit cost and timeout thing, then idk lol. Anyway if it screws up just tweak the settings until it doesn't. Honestly it works if you tweak it a few times. Generally the longer the diffing the more you should increase timeout. Or you can set it to 0 for best diffing at the cost of more time taken to diff. More information here: https://neil.fraser.name/software/diff_match_patch/svn/trunk/demos/demo_diff.html and "Increase computational efficiency by factoring out short commonalities which are not worth the overhead. The larger the edit cost, the more agressive the cleanup."

    edit: btw I do not code how diffing is done. The code is done by Google. The only coding I've done here is only a few lines xD

    edit2: @ below uhhh try harder ?_? haha. I usually just set it to 0 because I don't want to guage how much it might actually need cos the number might get too big for trail and error and it works fine. Or play around with edit cost.
    Last edited: Dec 12, 2013
  4. Kingler12345

    Kingler12345 COOKIE COOKIE COOKIE STARTS WITH C
    is a Contributor to Smogon

    Joined:
    May 26, 2013
    Messages:
    1,365
    yea i tried most stuff and it didnt work, for shorter checks i can use the editor anyway, so i didnt use diff. i will definitely try this though!!
  5. Lemonade.

    Lemonade. fluffy bird
    is a Smogon Social Media Contributoris an Artist Alumnusis a Forum Moderator Alumnusis a Contributor Alumnus

    Joined:
    Oct 16, 2010
    Messages:
    2,030
  6. sandshrewz

    sandshrewz POTATO
    is a Site Staff Alumnusis an Artist Alumnusis a Forum Moderator Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis a Battle Server Moderator Alumnus

    Joined:
    Oct 18, 2010
    Messages:
    2,452
  7. Lemonade.

    Lemonade. fluffy bird
    is a Smogon Social Media Contributoris an Artist Alumnusis a Forum Moderator Alumnusis a Contributor Alumnus

    Joined:
    Oct 16, 2010
    Messages:
    2,030
    The BB code is correct but the Output is not :/

    ALSO orange should be in deletion colors no addition colors
    [​IMG]
    Last edited: Dec 13, 2013
    The Immortal likes this.
  8. sandshrewz

    sandshrewz POTATO
    is a Site Staff Alumnusis an Artist Alumnusis a Forum Moderator Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis a Battle Server Moderator Alumnus

    Joined:
    Oct 18, 2010
    Messages:
    2,452
    lemolame stinks. The output is correct though. I intentionally didn't make the output change colors with what colors you picked. Moved orange over to deletions. I thought it should be with additions for CNY colors :( lol.

    Anyway, I updated the code slightly so that it has less chance of screwing up with comments when comments and additions can tangled up together. So far no one has experienced it so far but I did once during one of my small tests so to be safe I made it better. Let me know if it glitches up or something. Do try to preview your bbcoded diffs before posting just to be sure though. Thanks! :)

Users Viewing Thread (Users: 0, Guests: 0)