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
  1. Home
  2. General Programming
  3. C#
  4. a little help on "most used" codes !

a little help on "most used" codes !

Scheduled Pinned Locked Moved C#
questionhtmlhelp
21 Posts 10 Posters 1 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.
  • _ _Q12_

    "Most used" codes are the ones that you as a programmer put them away in a safe directory and from time to time peak at them when you are in trouble. You put them there and you know their order and meanings just enough to came in handy when you most in need of them. My question is: -How you people do this collection? ... more specific, in what form do you save these "most used" codes of yours? (my presumption is: You have a bunch of docx files with ton of codes inside them? You have some html pages saved from internet and stored somewhere safe? A bunch of simple text files, each one containing codes?)

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #12

    Sometimes as a simple .snippet[^]-file, or as an item-template[^] if it's a complete class. One can share the locations to these snippets and paths in a team :) If both categories don't fit, I'll most likely write another article; since an article would describe the problem that's being solved and probably would have example-code.

    I are Troll :suss:

    1 Reply Last reply
    0
    • _ _Q12_

      "Most used" codes are the ones that you as a programmer put them away in a safe directory and from time to time peak at them when you are in trouble. You put them there and you know their order and meanings just enough to came in handy when you most in need of them. My question is: -How you people do this collection? ... more specific, in what form do you save these "most used" codes of yours? (my presumption is: You have a bunch of docx files with ton of codes inside them? You have some html pages saved from internet and stored somewhere safe? A bunch of simple text files, each one containing codes?)

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #13

      Tons of simple notepad files. However, this is a very generic topic and not an ideal topic for discussion in the C# forum.

      The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.

      _ 1 Reply Last reply
      0
      • A Abhinav S

        Tons of simple notepad files. However, this is a very generic topic and not an ideal topic for discussion in the C# forum.

        The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.

        _ Offline
        _ Offline
        _Q12_
        wrote on last edited by
        #14

        yes, I am actually using this idea with txt files. But I also search for alternatives...that's why this topic. I am not sure if im doing it right, but at some level it seem that is the best way of storing my custom codes. I am curious if anybody have such a code library in the txt file format.... I wish to see how you do it. An example is great. thx.

        R 1 Reply Last reply
        0
        • _ _Q12_

          yes, I am actually using this idea with txt files. But I also search for alternatives...that's why this topic. I am not sure if im doing it right, but at some level it seem that is the best way of storing my custom codes. I am curious if anybody have such a code library in the txt file format.... I wish to see how you do it. An example is great. thx.

          R Offline
          R Offline
          RobScripta
          wrote on last edited by
          #15

          I think what you are looking for is what I use, it's a program called notetab (www.notetab.com). It's not free but cheap, and the best advantage is that you can create outline files. In an outline file you have at the left the table of content and you can jump to that page. If you organise your notes in appropiate outlines (tabbed at the top of the page) you can quickly jump to the correct note. I use this tool for "howto's" like push this button, and choose this checkbox etc. An example of this; if I need to display PDF's in a solution I choose my csharp outline, and click the page "pdf", there I have collected all my notes on how to handle pdf files (including links to my FTP notes). As I use a version of about 10 years old, I can't advise between the standard and pro version of the tool, but you definiately need outlines. Pure reusable code I have in a utilities DLL that is linked to every project. E.g. I use MySql as a database in almost all my projects, so code to connect to the database and manage the connection is all in the utilities DLL. Hope this helps. Rob

          _ 1 Reply Last reply
          0
          • _ _Q12_

            //"The vast amount of code is not generic. It has a specific purpose that has little if no meaning elsewhere."

            Yes I know that, and I agree. In essence is as you say.

            //"Code copying is done when code has a relationship to new functionality but requires modification. In those case I know where the original code is so I just go get it."

            Well, suppose you make 5 year ago a very good code (for yourself) and now you remember that you have that code, you have a similar application to make (some modification is required but at the base that code from 5 years ago remain the same at the core). You have the project from 5 years ago, saved into a 30G Hdd somewhere in your house? You make, back then for yourself, a library (as you suggested in your response)? 1-the simplest form of what is to store is like this: [this is a pure example -I don't want critics about this code here!] //IndexOf usage with string; Benchmark result String version: 1154 ms int i = s.IndexOf("a"); //Finds first "a" string in s. //IndexOf usage with char; Benchmark result Char version: 172 ms int i = s.IndexOf('a'); //Finds first 'a' char in s. 2-the complex form are entire programs, objects,methods, even controls. (You made them for your simplification in coding for later uses, as reminders or as core codes.) Thank you. Your response is the closest of what I intend to know. I hope that with your help I can decipher this mystery I am in to.

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #16

            merlinq12 wrote:

            //"Code copying is done when code has a relationship to new functionality but requires modification. In those case I know where the original code is so I just go get it."

            Well, suppose you make 5 year ago a very good code (for yourself) and now you remember that you have that code, you have a similar application to make (some modification is required but at the base that code from 5 years ago remain the same at the core). You have the project from 5 years ago, saved into a 30G Hdd somewhere in your house? You make, back then for yourself, a library (as you suggested in your response)?

            I create lots of good code. How would I know that when I created that code that I would want to use it 5 years from now?

            _ 1 Reply Last reply
            0
            • J jschell

              merlinq12 wrote:

              //"Code copying is done when code has a relationship to new functionality but requires modification. In those case I know where the original code is so I just go get it."

              Well, suppose you make 5 year ago a very good code (for yourself) and now you remember that you have that code, you have a similar application to make (some modification is required but at the base that code from 5 years ago remain the same at the core). You have the project from 5 years ago, saved into a 30G Hdd somewhere in your house? You make, back then for yourself, a library (as you suggested in your response)?

              I create lots of good code. How would I know that when I created that code that I would want to use it 5 years from now?

              _ Offline
              _ Offline
              _Q12_
              wrote on last edited by
              #17

              Well, the idea is not how you will know, because you never know what you will need in 10 minutes or 10 years from now on. The idea is how you find some very good code write sometime ago by you and put it to use (in the same direction or an alternative one with slight modifications). Lets presume...that you work on a game now, and after 5 years you will have a similar project somewhere else...it wont be beneficial if you will be able to take the entire or a part of "AI" from this game and reproduce it to the future one? (its just an example-but who knows). The really important blocks of codes from a big project or a small one, is not worth to copy it away in some deposit known only by you? The code and some nice directions/explanations, etc. But in the same time to be able to browse with no headache, search in a currently page or in all files at once and re/edit it as you go very fast and no headache involved also. To achieve this, the file format that you storage must be very well choose. thanks.

              M 1 Reply Last reply
              0
              • R RobScripta

                I think what you are looking for is what I use, it's a program called notetab (www.notetab.com). It's not free but cheap, and the best advantage is that you can create outline files. In an outline file you have at the left the table of content and you can jump to that page. If you organise your notes in appropiate outlines (tabbed at the top of the page) you can quickly jump to the correct note. I use this tool for "howto's" like push this button, and choose this checkbox etc. An example of this; if I need to display PDF's in a solution I choose my csharp outline, and click the page "pdf", there I have collected all my notes on how to handle pdf files (including links to my FTP notes). As I use a version of about 10 years old, I can't advise between the standard and pro version of the tool, but you definiately need outlines. Pure reusable code I have in a utilities DLL that is linked to every project. E.g. I use MySql as a database in almost all my projects, so code to connect to the database and manage the connection is all in the utilities DLL. Hope this helps. Rob

                _ Offline
                _ Offline
                _Q12_
                wrote on last edited by
                #18

                Notetab definitely is a great help. Thank you for pointing it to me. I was trying a lot of editing software (MS.Word, MindManager, Dreamweaver,ysitebuilder,html editors even C#-as a editing tool , but in time i give up and I return to the old txt files.) Why? -Because I needed a fast way to look/search/edit visually and explicitly. Changing the subject from notetab a bit,...The best wysiwyg software I encounter until now remain MS.Word - I have worked with it a lot and tried other variants of wysiwyg's but Word remain the no# 1...for me. So, if they could manage to make some search capabilities between docx files (not only infile)... then I will be not so stressed...but until that will appear, I'll stick with the oldies. Why I specify about that, is because the txt files are the inexpensive files for search inside them with minimum of hardware stress and with great speed (manual or automatic). That is the only reason I come back for them...though my heart is crying after wysiwyg friendliness. This is my "of".

                1 Reply Last reply
                0
                • _ _Q12_

                  Well, the idea is not how you will know, because you never know what you will need in 10 minutes or 10 years from now on. The idea is how you find some very good code write sometime ago by you and put it to use (in the same direction or an alternative one with slight modifications). Lets presume...that you work on a game now, and after 5 years you will have a similar project somewhere else...it wont be beneficial if you will be able to take the entire or a part of "AI" from this game and reproduce it to the future one? (its just an example-but who knows). The really important blocks of codes from a big project or a small one, is not worth to copy it away in some deposit known only by you? The code and some nice directions/explanations, etc. But in the same time to be able to browse with no headache, search in a currently page or in all files at once and re/edit it as you go very fast and no headache involved also. To achieve this, the file format that you storage must be very well choose. thanks.

                  M Offline
                  M Offline
                  Michael9000
                  wrote on last edited by
                  #19

                  When I started programming I created a lot of small code-samples to the the hang of the more complex things, and they are zipped with search-tags in their filenames. Now I'm doing the same for the abandoned projects thats worth saving.

                  _ 1 Reply Last reply
                  0
                  • M Michael9000

                    When I started programming I created a lot of small code-samples to the the hang of the more complex things, and they are zipped with search-tags in their filenames. Now I'm doing the same for the abandoned projects thats worth saving.

                    _ Offline
                    _ Offline
                    _Q12_
                    wrote on last edited by
                    #20

                    Can you provide me with some examples of your search-tags for filenames you use? And what kind of files are you using for storage -txt,html,doc? -or it dont matter. Thank you.

                    //I for example use this:
                    MostUsedCodes .txt
                    stringsCase-Insensitive Equals_b.txt
                    stringsSearch Contains_b.txt
                    stringsSearch IndexOf_i.txt
                    stringsSearch IndexOfAny_i.txt
                    stringsSearch LastIndexOf_i.txt
                    stringsSearch LastIndexOfAny_i.txt
                    stringsTest EndsWith_s.txt
                    stringsTest StartsWith_s.txt
                    //note: _s = string; _i=integer;

                    M 1 Reply Last reply
                    0
                    • _ _Q12_

                      Can you provide me with some examples of your search-tags for filenames you use? And what kind of files are you using for storage -txt,html,doc? -or it dont matter. Thank you.

                      //I for example use this:
                      MostUsedCodes .txt
                      stringsCase-Insensitive Equals_b.txt
                      stringsSearch Contains_b.txt
                      stringsSearch IndexOf_i.txt
                      stringsSearch IndexOfAny_i.txt
                      stringsSearch LastIndexOf_i.txt
                      stringsSearch LastIndexOfAny_i.txt
                      stringsTest EndsWith_s.txt
                      stringsTest StartsWith_s.txt
                      //note: _s = string; _i=integer;

                      M Offline
                      M Offline
                      Michael9000
                      wrote on last edited by
                      #21

                      I use both zip (for solutions) and plain txt for other more simple things. That way I can do a simple windows-search on the filenames. A simple class: GetFileIcon (win32, shell, pinvoke).txt A solution with the basic send/recieve and conversion: TcpClient-TcpListener (network, socket).zip

                      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