code base(not a technical question)

Discussion in 'Java' started by Asit Dhal, Aug 23, 2011.

  1. Asit Dhal

    Asit Dhal Guest

    I have a lot of code snippets in my system which I mostly use during development. Is there any tool(like VSS though I don't need version control) in which I can store them and later get whenever I need ?
     
    Asit Dhal, Aug 23, 2011
    #1
    1. Advertising

  2. On 08/23/2011 07:54 PM, Asit Dhal wrote:
    > I have a lot of code snippets in my system which I mostly use during
    > development. Is there any tool(like VSS though I don't need version
    > control) in which I can store them and later get whenever I need ?


    I don't quite understand: if you do not need revision control, you can
    store them anywhere - or put them into an archive. You could even
    compile them and package sources and class files into a JAR.

    Kind regards

    robert
     
    Robert Klemme, Aug 23, 2011
    #2
    1. Advertising

  3. Asit Dhal

    Asit Dhal Guest

    This is like thousands of text files containing code and explanation. This is impossible to retrieve efficiently.

    I need something which will tag something in a text file and store it. By searching in, I will get the code.
     
    Asit Dhal, Aug 23, 2011
    #3
  4. Asit Dhal

    Jeff Higgins Guest

    On 08/23/2011 01:54 PM, Asit Dhal wrote:
    > I have a lot of code snippets in my system which I mostly use during development. Is there any tool(like VSS though I don't need version control) in which I can store them and later get whenever I need ?
    >


    Web search terms code+snippet+storage
    This blog:
    <http://blog.programmableweb.com/2011/08/16/access-pastebins-code-snippets-and-hacker-rants-via-api/>
    suggests Snipt, Pastebin, Evernote.
     
    Jeff Higgins, Aug 23, 2011
    #4
  5. Asit Dhal

    Jeff Higgins Guest

    On 08/23/2011 04:53 PM, Jeff Higgins wrote:
    > On 08/23/2011 01:54 PM, Asit Dhal wrote:
    >> I have a lot of code snippets in my system which I mostly use during
    >> development. Is there any tool(like VSS though I don't need version
    >> control) in which I can store them and later get whenever I need ?
    >>

    >
    > Web search terms code+snippet+storage
    > This blog:
    > <http://blog.programmableweb.com/2011/08/16/access-pastebins-code-snippets-and-hacker-rants-via-api/>
    >
    > suggests Snipt, Pastebin, Evernote.
    >

    And then there's "Dude! Where's My Code! 1.1.6.0".
     
    Jeff Higgins, Aug 23, 2011
    #5
  6. On 11-08-23 05:48 PM, Asit Dhal wrote:
    > This is like thousands of text files containing code and explanation. This is impossible to retrieve efficiently.
    >
    > I need something which will tag something in a text file and store it. By searching in, I will get the code.


    You're basically talking about an (enterprise) content management
    system, or (E)CMS. One of the main things they do is store documents for
    efficient search and retrieval by metadata (properties or keywords) and
    content. There are a large number of free (and often open-source) CMSs
    out there - you've probably heard of Drupal and Alfresco, to mention two
    out of dozens.

    AHS
     
    Arved Sandstrom, Aug 23, 2011
    #6
  7. Asit Dhal

    markspace Guest

    On 8/23/2011 1:48 PM, Asit Dhal wrote:
    > This is like thousands of text files containing code and explanation.
    > This is impossible to retrieve efficiently.
    >
    > I need something which will tag something in a text file and store
    > it. By searching in, I will get the code.



    When I need to locate some code I've already written, I use grep.
     
    markspace, Aug 23, 2011
    #7
  8. Asit Dhal

    Arne Vajhøj Guest

    On 8/23/2011 4:48 PM, Asit Dhal wrote:
    > This is like thousands of text files containing code and explanation. This is impossible to retrieve efficiently.
    >
    > I need something which will tag something in a text file and store it. By searching in, I will get the code.


    Write a little Java app that can generate and search a full
    text index of the files content in a database.

    Optionally the files themselves can be stored in the database
    as well.

    I use such a tool for all the example code I have written over the
    years.

    Arne
     
    Arne Vajhøj, Aug 23, 2011
    #8
  9. Asit Dhal

    Arne Vajhøj Guest

    On 8/23/2011 5:05 PM, Arved Sandstrom wrote:
    > On 11-08-23 05:48 PM, Asit Dhal wrote:
    >> This is like thousands of text files containing code and explanation. This is impossible to retrieve efficiently.
    >>
    >> I need something which will tag something in a text file and store it. By searching in, I will get the code.

    >
    > You're basically talking about an (enterprise) content management
    > system, or (E)CMS. One of the main things they do is store documents for
    > efficient search and retrieval by metadata (properties or keywords) and
    > content. There are a large number of free (and often open-source) CMSs
    > out there - you've probably heard of Drupal and Alfresco, to mention two
    > out of dozens.


    I am sure that they can do it.

    But using Alfresco to be able to search a few thousand text
    files may be a bit of an overkill.

    Arne
     
    Arne Vajhøj, Aug 23, 2011
    #9
  10. Asit Dhal

    Jeff Higgins Guest

    On 08/23/2011 01:54 PM, Asit Dhal wrote:
    > I have a lot of code snippets in my system which I mostly use during development. Is there any tool(like VSS though I don't need version control) in which I can store them and later get whenever I need ?
    >


    Depending upon your development environment, you could search <my
    development environment>+code+snippet.
    When I search Eclipse+code+snippet, I get references to Snippet View and
    Template View. Thanks, I wasn't even aware of them.
    When I search emacs+code+snippet, I get yasnippet and Textmate.
     
    Jeff Higgins, Aug 24, 2011
    #10
  11. On 11-08-23 07:58 PM, Arne Vajhøj wrote:
    > On 8/23/2011 5:05 PM, Arved Sandstrom wrote:
    >> On 11-08-23 05:48 PM, Asit Dhal wrote:
    >>> This is like thousands of text files containing code and explanation.
    >>> This is impossible to retrieve efficiently.
    >>>
    >>> I need something which will tag something in a text file and store
    >>> it. By searching in, I will get the code.

    >>
    >> You're basically talking about an (enterprise) content management
    >> system, or (E)CMS. One of the main things they do is store documents for
    >> efficient search and retrieval by metadata (properties or keywords) and
    >> content. There are a large number of free (and often open-source) CMSs
    >> out there - you've probably heard of Drupal and Alfresco, to mention two
    >> out of dozens.

    >
    > I am sure that they can do it.
    >
    > But using Alfresco to be able to search a few thousand text
    > files may be a bit of an overkill.
    >
    > Arne
    >

    Granted. I wouldn't necessarily recommend IBM FileNet either. :)

    Still, my general observation stands: Asit is basically asking for CMS
    functionality. He can get that by writing his own, or by locating a
    minimal existing CMS solution.

    AHS
     
    Arved Sandstrom, Aug 24, 2011
    #11
  12. Asit Dhal

    Jeff Higgins Guest

    On 08/23/2011 07:06 PM, Jeff Higgins wrote:
    > On 08/23/2011 01:54 PM, Asit Dhal wrote:
    >> I have a lot of code snippets in my system which I mostly use during
    >> development. Is there any tool(like VSS though I don't need version
    >> control) in which I can store them and later get whenever I need ?
    >>

    >
    > Depending upon your development environment, you could search <my
    > development environment>+code+snippet.
    > When I search Eclipse+code+snippet, I get references to Snippet View and
    > Template View. Thanks, I wasn't even aware of them.
    > When I search emacs+code+snippet, I get yasnippet and Textmate.
    >
    >

    Another Eclipse feature you're post reminded me of is the Java Scrapbook
    Page. Thanks I had forgotten it.
     
    Jeff Higgins, Aug 24, 2011
    #12
  13. Asit Dhal

    Asit Dhal Guest

    Thank you everybody for reading my query and suggesting me.

    This is what I do now.
    I have a folder named Java. In this folder code snippets are stored in small text files. File name is what the snippet is about.
    e.g.:-
    CounDownLatch.java
    HorseRace.java
    SingletonThreaSafe.java

    What I need is every file should be associated with some index string, which is search able.

    Again grep can't help me as I use Windows 7 for development environment.
     
    Asit Dhal, Aug 24, 2011
    #13
  14. Asit Dhal <> wrote:
    > This is what I do now.
    > I have a folder named Java. In this folder code snippets are stored
    > in small text files. File name is what the snippet is about.
    > e.g.:-
    > CounDownLatch.java
    > HorseRace.java
    > SingletonThreaSafe.java
    > What I need is every file should be associated with some index string,
    > which is search able.
    > Again grep can't help me as I use Windows 7 for development environment.


    I'm sure, there's also "grep" for Windows (7, like any other).

    But then, grep wouldn't satisfy your needs, anyway, as you'd better
    find some kind of fuzzy-search-engine. A non-fuzzy search wouldn't
    find anything for "Count" or "Thread" among the snippets you named...

    PS: I'm being serious here. If your spelling isn't all that good,
    then you're going to have a hard time later, trying to figure
    out with what spelling errors you might have stored a particular
    snippet some time ago. A fuzzy search may then be a big help.
     
    Andreas Leitgeb, Aug 24, 2011
    #14
  15. Asit Dhal

    markspace Guest

    On 8/24/2011 12:03 PM, Asit Dhal wrote:
    > code snippets are stored in small text files. File name is what the
    > snippet is about. e.g.:- CounDownLatch.java HorseRace.java
    > SingletonThreaSafe.java
    >
    > What I need is every file should be associated with some index
    > string, which is search able.



    grep and other unix tools are of course available for Windows.

    I don't understand what you think you're going to build the index string
    with. What goes in the index string? All symbols in the file? Just
    the file names? Please be as specific as possible.


    For example, here's a code snippet:

    hw.java:
    package simple;
    public class Hello {
    public static void Main( String... args ) {
    System.out.println( "Hello world" );
    }
    }

    What precisely would go in your index string for this example?
     
    markspace, Aug 24, 2011
    #15
  16. On 24.08.2011 21:03, Asit Dhal wrote:
    > Thank you everybody for reading my query and suggesting me.
    >
    > This is what I do now.
    > I have a folder named Java. In this folder code snippets are stored in small text files. File name is what the snippet is about.
    > e.g.:-
    > CounDownLatch.java
    > HorseRace.java
    > SingletonThreaSafe.java
    >
    > What I need is every file should be associated with some index
    > string, which is search able.
    >
    > Again grep can't help me as I use Windows 7 for development
    > environment.


    You can use "find" for that in the Windows shell.

    However, I would just create an Eclipse project where I put all those
    files and use Eclipse's text search (which is pretty fast). You could
    even do something like

    /*
    * Search index
    *
    * keyword: thread
    * keyword: list
    */

    somewhere in the file and then do a regexp search for "keyword:\s*thread"

    Kind regards

    robert

    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
     
    Robert Klemme, Aug 25, 2011
    #16
  17. Asit Dhal

    Roedy Green Guest

    On Tue, 23 Aug 2011 10:54:35 -0700 (PDT), Asit Dhal
    <> wrote, quoted or indirectly quoted someone who
    said :

    >I have a lot of code snippets in my system which I mostly use
    >during development. Is there any tool(like VSS though I don't
    > need version control) in which I can store them and later get whenever I need ?


    You could just store them as files in a directory tree. What other
    service do you need?
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    The modern conservative is engaged in one of man's oldest exercises in moral philosophy; that is,
    the search for a superior moral justification for selfishness.
    ~ John Kenneth Galbraith (born: 1908-10-15 died: 2006-04-29 at age: 97)
     
    Roedy Green, Aug 25, 2011
    #17
  18. On Thu, 25 Aug 2011 13:07:40 -0700, Roedy Green wrote:

    > On Tue, 23 Aug 2011 10:54:35 -0700 (PDT), Asit Dhal <>
    > wrote, quoted or indirectly quoted someone who said :
    >
    >>I have a lot of code snippets in my system which I mostly use during
    >>development. Is there any tool(like VSS though I don't
    >> need version control) in which I can store them and later get whenever
    >> I need ?

    >
    > You could just store them as files in a directory tree. What other
    > service do you need?


    I converted my snippets onto a set of classes in a private package/jar
    file, documented it using Javadoc and put the lot under CVS to provide a
    bit of fat-finger protection. I thought that was what most programmers do.


    --
    martin@ | Martin Gregorie
    gregorie. | Essex, UK
    org |
     
    Martin Gregorie, Aug 25, 2011
    #18
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    315
  2. Jon

    Technical question?

    Jon, Oct 10, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    441
    perspolis
    Oct 11, 2005
  3. Philip Chua
    Replies:
    1
    Views:
    614
  4. flit
    Replies:
    22
    Views:
    672
    Gabriel Genellina
    Mar 23, 2007
  5. Trukin
    Replies:
    1
    Views:
    301
    =?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=
    Aug 16, 2007
Loading...

Share This Page