Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. Copy and Paste

Copy and Paste

Scheduled Pinned Locked Moved The Lounge
csharpvisual-studiocollaborationquestiondiscussion
10 Posts 6 Posters 3 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Serge Lobko Lobanovsky
    wrote on last edited by
    #1

    :-D Being tired to death of seeing the huge blocks of dumb copy-and-paste in fellow programmers' code, I suggest creating an addin for VS: 1) It allows only a single line to be copied to the clipboard and pastes at a time 2) When trying to copy 2-7 lines, it suggests to refactor the lines into a function 3) When trying to copy 8-15 lines, it prompts for a password. Password is randomly generated. 4) When copying more then 15 lines, it automatically sends an e-mail notification to the team leader What do you think? Regards, Serge (Logic Software, Easy Projects .NET site)

    M A J S 4 Replies Last reply
    0
    • S Serge Lobko Lobanovsky

      :-D Being tired to death of seeing the huge blocks of dumb copy-and-paste in fellow programmers' code, I suggest creating an addin for VS: 1) It allows only a single line to be copied to the clipboard and pastes at a time 2) When trying to copy 2-7 lines, it suggests to refactor the lines into a function 3) When trying to copy 8-15 lines, it prompts for a password. Password is randomly generated. 4) When copying more then 15 lines, it automatically sends an e-mail notification to the team leader What do you think? Regards, Serge (Logic Software, Easy Projects .NET site)

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      Serge Lobko-Lobanovsky wrote: huge blocks of dumb copy-and-paste in fellow programmers' code VB? :-D Marc MyXaml Advanced Unit Testing

      A S C 3 Replies Last reply
      0
      • S Serge Lobko Lobanovsky

        :-D Being tired to death of seeing the huge blocks of dumb copy-and-paste in fellow programmers' code, I suggest creating an addin for VS: 1) It allows only a single line to be copied to the clipboard and pastes at a time 2) When trying to copy 2-7 lines, it suggests to refactor the lines into a function 3) When trying to copy 8-15 lines, it prompts for a password. Password is randomly generated. 4) When copying more then 15 lines, it automatically sends an e-mail notification to the team leader What do you think? Regards, Serge (Logic Software, Easy Projects .NET site)

        A Offline
        A Offline
        Antony M Kancidrowski
        wrote on last edited by
        #3

        :laugh: I would fall in to that trap legitimately as I have header comments that I copy, paste then modify in order to explain what the function is used for. One of these days I will set up a macro to generate the comments for me!. Ant. I'm hard, yet soft.
        I'm coloured, yet clear.
        I'm fruity and sweet.
        I'm jelly, what am I? Muse on it further, I shall return!
        - David Walliams (Little Britain)

        S 1 Reply Last reply
        0
        • M Marc Clifton

          Serge Lobko-Lobanovsky wrote: huge blocks of dumb copy-and-paste in fellow programmers' code VB? :-D Marc MyXaml Advanced Unit Testing

          A Offline
          A Offline
          Antony M Kancidrowski
          wrote on last edited by
          #4

          Marc Clifton wrote: VB? It's any opportunity for you isn't it Marc? Ant. I'm hard, yet soft.
          I'm coloured, yet clear.
          I'm fruity and sweet.
          I'm jelly, what am I? Muse on it further, I shall return!
          - David Walliams (Little Britain)

          1 Reply Last reply
          0
          • M Marc Clifton

            Serge Lobko-Lobanovsky wrote: huge blocks of dumb copy-and-paste in fellow programmers' code VB? :-D Marc MyXaml Advanced Unit Testing

            S Offline
            S Offline
            Serge Lobko Lobanovsky
            wrote on last edited by
            #5

            Actually, VB.NET. And will admit I've seen some C#, too ;-) Regards, Serge (Logic Software, Easy Projects .NET site)

            1 Reply Last reply
            0
            • A Antony M Kancidrowski

              :laugh: I would fall in to that trap legitimately as I have header comments that I copy, paste then modify in order to explain what the function is used for. One of these days I will set up a macro to generate the comments for me!. Ant. I'm hard, yet soft.
              I'm coloured, yet clear.
              I'm fruity and sweet.
              I'm jelly, what am I? Muse on it further, I shall return!
              - David Walliams (Little Britain)

              S Offline
              S Offline
              Serge Lobko Lobanovsky
              wrote on last edited by
              #6

              Well, we could add a kind of smart templates, which could sense whether the code block can be copy-pasted. *thinking*... Regular expressions? :laugh: Regards, Serge (Logic Software, Easy Projects .NET site)

              1 Reply Last reply
              0
              • S Serge Lobko Lobanovsky

                :-D Being tired to death of seeing the huge blocks of dumb copy-and-paste in fellow programmers' code, I suggest creating an addin for VS: 1) It allows only a single line to be copied to the clipboard and pastes at a time 2) When trying to copy 2-7 lines, it suggests to refactor the lines into a function 3) When trying to copy 8-15 lines, it prompts for a password. Password is randomly generated. 4) When copying more then 15 lines, it automatically sends an e-mail notification to the team leader What do you think? Regards, Serge (Logic Software, Easy Projects .NET site)

                J Offline
                J Offline
                Jon Hulatt
                wrote on last edited by
                #7

                But what about if you fell foul of (2), and then defined a new function and wanted to copy the blob of text into the function! And surely if you wrote that add-in, some enterprising programmer might write another add-in which allows copy/paste blocks of text with the paste being one line at a time ;-)

                using System.Beer;

                S 1 Reply Last reply
                0
                • J Jon Hulatt

                  But what about if you fell foul of (2), and then defined a new function and wanted to copy the blob of text into the function! And surely if you wrote that add-in, some enterprising programmer might write another add-in which allows copy/paste blocks of text with the paste being one line at a time ;-)

                  using System.Beer;

                  S Offline
                  S Offline
                  Serge Lobko Lobanovsky
                  wrote on last edited by
                  #8

                  I would hook the paste op in VS, and insert a Thread.Sleep(ONSECOND) after it :) Regards, Serge (Logic Software, Easy Projects .NET site)

                  1 Reply Last reply
                  0
                  • M Marc Clifton

                    Serge Lobko-Lobanovsky wrote: huge blocks of dumb copy-and-paste in fellow programmers' code VB? :-D Marc MyXaml Advanced Unit Testing

                    C Offline
                    C Offline
                    Chris Meech
                    wrote on last edited by
                    #9

                    I still remember the day, that the following conversation took place

                    PM : Didn't you just fix the currency conversion bug?
                    Me : Yeah, I did that already. On the Valuation report, where you showed me it was incorrect.
                    PM : Well here's the Transaction report, it's not fixed there.
                    Me : WTF??

                    When I next went into the code for the Transaction report, I find an exact duplicate of around 50 lines of code, with the exact same bug that I had already fixed. After slapping myself on the head, I then went through about 15 other report classes and discovered the same code with the same bug in 13 of them. After a little refactoring, I had everything fixed up, but from then on, as I was fixing up things to work, I was always spending some extra time doing searches for duplicate code. The moral again, COPY/PASTE is a great tool, but in the wrong hands can create nightmares. :) Oh and btw, this was a c++ application. ;P Chris Meech I am Canadian. [heard in a local bar] Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden] Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]

                    1 Reply Last reply
                    0
                    • S Serge Lobko Lobanovsky

                      :-D Being tired to death of seeing the huge blocks of dumb copy-and-paste in fellow programmers' code, I suggest creating an addin for VS: 1) It allows only a single line to be copied to the clipboard and pastes at a time 2) When trying to copy 2-7 lines, it suggests to refactor the lines into a function 3) When trying to copy 8-15 lines, it prompts for a password. Password is randomly generated. 4) When copying more then 15 lines, it automatically sends an e-mail notification to the team leader What do you think? Regards, Serge (Logic Software, Easy Projects .NET site)

                      S Offline
                      S Offline
                      Shog9 0
                      wrote on last edited by
                      #10

                      Oddly enough (or... not, really), one of the largest chunks of code i've ever found duplicated in such a way was the logic for... (wait for it)... copy/cut/paste. Seems it'd been implemented in one of the first view classes written, and simply copied and "extended" for all the rest. And yeah, this was C++/MFC.
                      "The time has come," the Walrus said, "To talk of many things..."

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups