Community
    • Login

    Remove duplicate numerical lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    48 Posts 8 Posters 24.4k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • PeterJonesP Offline
      PeterJones
      last edited by PeterJones

      I’m on 7.5.8 32-bit, with PythonScript 1.3.0.0…

      And now @Scott-Sumner has actually given me a valid reason to downvote him, because if he stops posting PythonScript, it will be up to me… and I just don’t have the py-knowledge to keep up for long. :-)

      Scott SumnerS 1 Reply Last reply Reply Quote 1
      • Scott SumnerS Offline
        Scott Sumner @PeterJones
        last edited by

        @PeterJones

        valid reason to downvote

        First labeled a “retard”, then spanked vigorously by Don Ho in perhaps an interesting overreaction…and now downvoted by Peter… I’m super unpopular. :-(

        Eko palypseE 1 Reply Last reply Reply Quote 2
        • Meta ChuhM Offline
          Meta Chuh moderator
          last edited by

          @Scott-Sumner:

          don’t worry, you’re not … i’m currently googling for a specific helping hack:

          nodebb plugin hack that downvotes from specific users triggers a double upvote
          (alternative: hack that there are two upvote buttons left and right of the counter for specific user accounts)

          @PeterJones

          also don’t worry, i’m currently googling for a specific helping hack:

          nodebb browser hack that specific users, who refuse to post scripts, are unable to close the np++ browser window ever again
          (alternative: they can close it, but as soon as they do, the same page will pop up on their cellular phones)

          looool ;-)

          1 Reply Last reply Reply Quote 2
          • PeterJonesP Offline
            PeterJones
            last edited by

            I’m super unpopular

            … says the one who has 70% higher reputation than anyone else in these forums. :-) Fortunately, downvotes can be transitory: 'Twas done as a joke, referring back to the time that the interface made it look like I had downvoted Scott. But my real downvotes are reserved for egregious behavior – posting spam in the forums, primarily – so I removed this one.

            And yes, it does seem to have been rather rough in the forums recently: gang up on Scott this week; last week, I got so frustrated due to a certain conversation that I was within moments of deciding to not bother reading/posting here; and, I’m sure Don hasn’t had the best time, with all the problems that showed up in the transition to 7.6. Hopefully, it will mellow out again soon.

            Anyway, I learned a lot through all the code examples and the experiments they prompted. Thanks all.

            Meta ChuhM 1 Reply Last reply Reply Quote 1
            • Meta ChuhM Offline
              Meta Chuh moderator @PeterJones
              last edited by

              @PeterJones

              transition to 7.6. Hopefully, it will mellow out again soon.

              i think i’m afraid not.
              there have been new complaints that, now that all plugins reside at a single, all users accessible location inside %programdata% as the active posters wished, others that were silent before want it either in a different location or the way it was in 7.6 … or the way it was in 7.5.9 … or inside of %programfiles%

              1 Reply Last reply Reply Quote 0
              • Eko palypseE Offline
                Eko palypse
                last edited by

                This is where real life and software development goes hand in hand - you can’t make everyone happy.

                Eko

                rinku singhR 1 Reply Last reply Reply Quote 0
                • rinku singhR Offline
                  rinku singh @Eko palypse
                  last edited by

                  @Eko-palypse
                  https://drive.google.com/file/d/1i3xhDiybd6FWb0hC2Pu72oeCQEhTYF4W/view?usp=sharing

                  Eko palypseE 1 Reply Last reply Reply Quote 0
                  • Eko palypseE Offline
                    Eko palypse @rinku singh
                    last edited by

                    @gurikbal-singh

                    not sure what to do!?? What about the uploaded zip?

                    Eko

                    rinku singhR 1 Reply Last reply Reply Quote 0
                    • rinku singhR Offline
                      rinku singh @Eko palypse
                      last edited by

                      @Eko-palypse
                      zip file has contain a plugin for you
                      this plugin can remove duplicate lines

                      Eko palypseE 1 Reply Last reply Reply Quote 0
                      • Eko palypseE Offline
                        Eko palypse @rinku singh
                        last edited by

                        @gurikbal-singh

                        Thank you very much for your effort but I wasn’t asking for one,
                        I offered a possible solution by using the pythonscript plugin
                        but maybe @rizla-kostas, the original poster, finds this useful.

                        Eko

                        1 Reply Last reply Reply Quote 0
                        • Alan KilbornA Offline
                          Alan Kilborn
                          last edited by

                          I was looking at the EOL at EOF thing and I liked the scripts presented in regards to same. However, after the script is in place…what if I WANT to create a file without the final EOL, a very occasional need maybe?

                          So I came up with this few lines of code that can be inserted into the scripts, which will prevent the script from doing anything if the Alt key is held while a save is being done.

                          import ctypes
                          VK_MENU = VK_ALT = 0x12
                          if ctypes.windll.user32.GetKeyState(VK_ALT) & 0x8000: return
                          

                          In practice this only works when Save or SaveAll is done via toolbar button. :)

                          1 Reply Last reply Reply Quote 2
                          • Eko palypseE Offline
                            Eko palypse @Scott Sumner
                            last edited by Eko palypse

                            @Scott-Sumner

                            I did some tests concerning the performance and memory usage about calculating whether the last line contains an eol or not.
                            I opened a ~600MB file and run the following script

                            from Npp import editor
                            import time
                            
                            start = time.time()
                            lastLineContainsEOL = True if len(editor.getLine(editor.getLineCount()-1)) == 0 else False
                            end = time.time() - start
                            print 'getLine:', end
                            
                            start = time.time()
                            lastLineContainsEOL = True if editor.getText()[-1] in '\n\r' else False
                            end = time.time() - start
                            print 'getText:', end
                            
                            start = time.time()
                            lastLineContainsEOL = True if editor.getCharacterPointer()[-1] in '\n\r' else False
                            end = time.time() - start
                            print 'getCharacterPointer:', end
                            

                            which resulted in

                            getLine: 0.000999927520752
                            getText: 2.94100022316
                            getCharacterPointer: 0.641000032425
                            

                            then I did the same test while watching the performance monitor and saw that
                            editor.getText()[-1] allocated an additional 600 MB whereas editor.getCharacterPointer()[-1] didn’t.

                            So, currently it seems that len(editor.getLine(editor.getLineCount()-1)) == 0 is the fastest and best on resources
                            whereas getCharacterPointer might be a fast way to access the buffer as long as you know what you are looking for.

                            Eko

                            1 Reply Last reply Reply Quote 2
                            • PeterJonesP Offline
                              PeterJones
                              last edited by

                              I have sent a private apology to @Scott-Sumner, but I thought I should also make a public apology: downvotes aren’t something to joke with (or about), and my initial response (after I had seen it bothered him) was still couched in humor (and probably not very funny, at that), when it should not have had any attempts at justification or humor. I have been sorry for my poor choices on that day since I saw his response, and I have been saddened as he has stayed away for the last two weeks. I wish I knew how to make it up to him, but saying that I’m sorry is all that I know to do.

                              I highly respect Scott, and value his contributions to this forum. I hope he will come back and participate again.

                              Meta ChuhM 1 Reply Last reply Reply Quote 2
                              • Meta ChuhM Offline
                                Meta Chuh moderator @PeterJones
                                last edited by

                                i miss you too @Scott-Sumner and i hope you read this some day.

                                i’m sorry too for everything that happened and my failed humorous attempts to brighten up the situation.

                                i think that don didn’t even look to whom he gave this reply at that certain moment, and i know how this must feel … like a job where a 3 year “underpaid” employee, who is also probably the biggest defender and supporter of this hypothetical company, suddenly gets a “who the hell are you” from the boss.

                                please come back, or more important: we, specifically i as an individual would like to keep in contact, regardless of how, when or where.

                                thanks @PeterJones for standing up.
                                (i currently have a certain movie scene in my mind … “o captain my captain” from the movie dead poets society)

                                1 Reply Last reply Reply Quote 0
                                • Alan KilbornA Alan Kilborn referenced this topic on

                                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                With your input, this post could be even better 💗

                                Register Login
                                • First post
                                  Last post
                                The Community of users of the Notepad++ text editor.
                                Powered by NodeBB | Contributors