code base(not a technical question)

A

Asit Dhal

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 ?
 
R

Robert Klemme

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
 
A

Asit Dhal

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.
 
A

Arved Sandstrom

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
 
M

markspace

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.
 
A

Arne Vajhøj

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
 
A

Arne Vajhøj

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
 
J

Jeff Higgins

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.
 
A

Arved Sandstrom

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
 
J

Jeff Higgins

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.
 
A

Asit Dhal

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.
 
A

Andreas Leitgeb

Asit Dhal said:
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.
 
M

markspace

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?
 
R

Robert Klemme

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
 
R

Roedy Green

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)
 
M

Martin Gregorie

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top