How do you organize example code for future reference? [closed] - organization

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed last month.
Improve this question
Very often when programming, I find that I encounter problems that I have solved in the past, but don't remember the solution to. I've been trying to record notes and code snippets of solutions I come up with so that I can reference them in the future. but I don't know the best way organize my solutions so that I can quickly and productively find them in the future.
Right now I've been putting code examples into separate files in a big directory, but it can get hard to find things for the future. It would also be nice to have the ability to search for keywords so that I can quickly find what I'm looking for.
Does anyone have any suggestions for how to organize a personal body of code to use as reference for future programming?

In the past, I tried to organize my folders and make a "Dictionary" of different problems with their solutions. Unfortunately, I found it was very time consuming even though it was well organized with a few collegues.
If you're working with common languages (C#, VB.Net, Java, html, javascript, css, ...), Internet is your best repository. I find it faster to type what I want on a search engine (or stackoverflow directly) than browse into a home made repository.
If you still want to make a repository, I prefered keeping the entire projects and have a "master file (excel can do)" where you can search for keywords and find which project deals with the problem.
Once in a project, you can do another search for the exact location. I found it less time consuming to do another search than pointing the diffrerents files/functions to look at in the "master file".
Hope this helps.

A friend of mine introduced me to Notion. It's basically like Evernote but has quite a lot more and you can write code blocks etc. Ever since, I use that to keep references of code and some explanations etc. Most of the time I'm too lazy to even copy and paste code snippets I find on Stack Overflow and so I just copy links into there as well. Anyway, I think some sort of integrated solution like this is pretty great.

Related

Vim-like command-line spreadsheet SC - How do you deal with the lack of Undo feature? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm looking for a command-line spreadsheet and so far sc is my best find (I explain why at the end of this message).
But the lack of Undo feature is killing me. How do you deal with the lack of this vital missing feature?
Right now, when I make a mistake, I either have to correct it manually; or I have to close the file without saving, re-open it, and re-do all the recent changes - which is a pain; in fact, it makes me just want to not use sc at all, which is a shame as it's the only spreadsheet that seems to do everything else I want.
I've come up with a wonky solution (haven't tried it yet): as the F-keys are programmable, I could make one of them commit my spreadsheet in Git, and another one "undo" my recent changes, by reversing to the previous commit. And maybe also one to redo. That's not ideal, really... So I would appreciate any better idea.
Oh, also! Another missing feature of sc is the community. There is not mailing list (nor IRC channel). If there's people around using sc, I might be up for setting up a mailing list so we can exchange questions and ideas. Any takers?
Appendix: Why sc is the best command-line spreadsheet for me so far:
It's still (passively) maintained,
has Vim key bindings,
functions can be programmed in any language
cells can run external commands and return their output in the cell
can apply colors to cells and text (I use spreadsheets to "tell a story", or to "help me understand something", so I need it to be visually obvious, what values I can manipulate and where the interesting results are)
can encrypt/decrypt spreadsheets
Here is a bit more info about sc:
simple tutorial
manual (lists most key bindings)
step by step manual
man page (That's where you will find most info, really)
And here is the Github issue for the Undo feature. It is tagged "will take patch", and there is a discussion of different ways the feature could be implemented.
PS: Another command-line spreadsheet you might want to have look at is teapot, which also seems excellent (and also lacks the Undo feature). In fact it has got excellent features that sc lacks, but personally I would use sc for the Vim key bindings, the colors, and the fact that I can program functions in any language.
PPS: I didn't have enough reputation to post this message with the tag "sc", so I tagged it Vim instead, as Vim users might be interested by this spreadsheet.

Eclipse Project description - NOT .project file - is there such a thing? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a whole bunch of Eclipse projects, large and small, that I want to keep organized. I'm trying to figure out if there is some sort of property that can be attached to the project in order to provide a description of what the project is or what it was created to do or test. I would hope that this field can be easily viewed at the time you are browsing through a list of projects. It would be nice if I could put descriptive text into this field and not have to consider giving my projects names like 'TwitterOAuth2TestImplementationUsingScribe'
Anything that would allow you to browse your projects in a way similar to this (each line represents an Eclipse project):
Myproj1 Simple Test Project
LogTest3 Test new logging class
NetworkUDPTests Testing UDP classes
OAuth2Example Sample project for Oauth2
Unfortunately, project "description" is the name of the .project file that stores each project's settings, so it is a bit harder to search for information on this.
Thats an interesting question we also face. Currently there does not seem to exist a solution for this problem. The only thing that could come near to providing one is the Mylyn Intent project, as it aims to provide a comprehensive documentation on design decisions, which takes into account the inter-dependencies between plugins.
This inter-dependency is exactly the problem. There exist solutions to document the purpose of java packages which is limited to the classes however.
Our solution is a readme.textile embedded in the root of each plugin, providing this specific information. It would, however, be interesting to introduce the documentation used for packages for bundle documentation, which could be used to autogenerate an overview documentation.
There is a comment tag in the .project file: http://help.eclipse.org/luna/topic/org.eclipse.platform.doc.isv/reference/misc/project_description_file.html
However it looks like Eclipse itself doesn't use the content of this tag. I changed it manually but after that I've never seen the text I entered anywhere in Eclipse

Eclipse for Visual Studio dummies [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Looking for links to good information for Eclipse beginners. I've been a c# developer for sometime and I feel like I'm swimming in molasses. I'm especially interested in anything like the snippets functionality and how to use it (for example the prop snippet to create a property)
I'd recommend you start with the tutorials on the "Welcome" screen (automatically shown on first launch, or via Help menu).
After that, a lot of stuff can be discovered by poking around. The built-in help is also quite good, and failing that, just google for it.
Set yourself some goal, and do a bit of research; I've found most stuff fairly easily that way.
As for snippets: I'm not terribly familiar with VS, but I gather they are basically code templates that you can insert and then fill in.
In Eclipse, that would be auto-complete (or "Content Assist"), triggered by Ctrl-Space. Just try it, it's fairly clever. It will offer completions of variable names, functions etc., but will also offer common snippets like creating constructors, public methods etc. E.g. type "public ctrl-spc", and it should offer a template for a public method (try ctrl-space several times to cycle through proposals).
You can also create your own auto-complete code snippets. These are called templates in Eclipse, to be found in the prefs under "Java / Editor / Templatest". Templates can be triggerd in auto-complete by typing the (beginning) of the template's name, then auto-completing.
Have fun!
I was also a VS user for a long time and found Eclipse confusing, requires a lot more configuration to get it up and running first off.
Found this very helpful post on a Google search
http://benpryor.com/blog/2006/03/03/top-10-tips-for-new-eclipse-users/
.
I don't use it often but here are a few things that threw me at first.
Workspaces confused me, there is no exact equivalent in VS, I'd say they are a bit like Solutions. I made the mistake of keeping all my projects in one workspace and after a year of work Eclipse could barely open the workspace.
You don't need to hit 'Build' to compile your code, it keeps compiling in the background so there is always an up to date list of bugs, called problems in Eclipse.
When you run your code in debug all the windows jump about some disappear and lots of strange new ones open. These different layouts are called perspectives. There is a tab bar next to the main tool bar which lets you move between open perspectives or you can close them using the Window menu.
Besides the very good Eclipse tutorials and documentation sleske mentioned here are some other good tutorials and introductions:
IBM tutorial for Visual Studio users - you have to register for reading this tutorial but registration is free and you can download a bunch of really good Eclipse materials
Effective Eclipse - Custom Templates - this article shows you Eclipse's "snippets funcionality" in details

Emacs Wishlist: what features is emacs lacjing right now? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Emacs is great. To me at least, Emacs is a metaphor of all software. Still, I know that it lacks some features sometimes that you have to actually migrate to other environments. Given emacs is so customizable, and great and everything, we only have to wish for it right? What do you think is a feature that emacs lacks right now?
Note: As of Emacs 23, there is support for M-x butterfly.
There is a wishlist on EmacsWiki.
I'd like to see a better package manager for emacs. Perhaps something like RIP? ELPA looks interesting, but I don't like that it's trying host and consolidate all the packages. I'd prefer to be able to add modules from any git or cvs repository I find. I'd also like the modules in this theoretical package manager to have a standard way to include icons and info file. Finally, I'd like it to have a dead-simple method of compiling all modules.
I've tried to modularize my emacs files in this style (see my github emacs.d repo), though I'd happily ditch it if something better gained widespread support.
An implementation of elisp that's not 1985's state of the art. I mean, seriously -- global variables everywhere? A non-reentrant parser? It's like they don't want people to work on it. I briefly looked at adapting Emacs to be a shared library, but I couldn't get past even parsing elisp files.
I wish a standard code sense autocompletion(hippie-expand is some kind out of date), and a better GUI to support such things as the flowing completion candidates list which should be no worse than that of VIM.
Well, since Emacs is moving to guile, meaning modern lisp is imminent, the only things I want is the ability to add buttons somewhere. A button browser, or a toolbar buffer would be nice.
On the other hand, one of the best things about emacs is that it doesn't populate your screen with just about anything.
However, the ability to for instance, make a JUnit testing buffer in it's own buffer, etc. would be great. Perhaps forcing button buffers being in it's own frame of something (a new type of frame, like GUI-frame or something?)
Oh, and better rendering capabilities, and a flash plugin so we don't have to start a separate program just to browse the web.
Edit: By "imminent" I mean imminent as in geologically imminent.
Since you have C-x M-c M-butterfly, you really don't need much else.

How to handle different csproj [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I am working in a team of five. We are working on a C# application with five csprojects.
The problem is that for each csproject, each of my colleagues has their own ideas on how to reference a DLL; some would like to link in by Project reference, other would like to link in the DLL only. So each and every one of us will have our own csproject.
I want all of them to check in their csproject; but given that every copy of csproject is different, there isn't really a feasible mechanism to do that, is there? But if I don't ask them to check in their csproject, then every time they add a new file, I would have to manually edit my csproject and that's very tedious, not to mention that it beats the purpose of continuous integration.
Is there any strategy to handle this? I know it would be best to enforce a standard, but is there any other option leaving this aside?
There is a reason why the csproject content is different for everyone; not everyone has all of the five csprojects, and not everyone can have all of the 5 csprojects. So invariably some will have to end up having to reference DLLs instead of projects, and some want to reference by projects for the ease of debugging. If I were to enforce a standard, as the answers here suggest, I would have to solve this issue.
As to why we need to split into multiple csprojects, that's because we want to reuse some parts of the code for other applications, and because not everyone can have all access to the source code. It's more political than technological.
Your problem is not how to handle it with Source Control.
Your problem is that you (or management) needs to get your team to adopt a set of standards the entire team follows.
If you let everyone follow their own mish-mash of ideas and do not get team cohesion on the basics it will only end in tears...
You're almost certainly solving the wrong problem. If you fork the .csproj files to cater to invididual preferences, you are incurring additional work and introducing the likelihood of errors, for exactly the reason you describe -- every time Alice adds a file to AlicesX.csproj, Bob has to learn about this and add the same file to BobsX.csproj.
You really need to consider this as a problem of standards and team dynamics: agree on how DLLs will be referenced in the master sources, and require everyone to stick to that. If the "losing" side don't like to work that way, sure, they can use their preferred style in their private working copies. But you really only want one master source, and you want to work towards getting everybody to buy into the way the master source does it.
Per your edit: If you really, really cannot come to an agreement with your colleagues, then I would still suggest a single master, but write a little utility that the dissenters can use that converts project references to DLL references (or vice versa). .csproj files are just XML so this is pretty trivial to do. If you cannot even agree on what is going to be the repository format, then you will need to maintain parallel .csproj files, but I'd still write the utility to ensure that changes made to DllReferencingProj.csproj get copied to ProjectReferencingProj.csproj. But I still say you're just making more work and storing up more pain for yourself than if you had the squabble and got it over with: in order to function as a team, you're going to need to find some way of resolving disputes, and this is as good as test case as any.
Time to make everyone grow up and follow a standard. If you're all working on the same code you should decide together whether referencing the dll or the project is best and then stick to it. Once you guys figure this one out you can decide whether to indent 2 or 4 spaces or a tab. Then decide whether to put your curly braces on the same line as or the next line after your function declarations. I'm not even going to speak to the vagaries of Hungarian notation...
Our configuration is as follows:
Project -> copy dll to common folder
Project -> copy dll to common folder
Main Project -> Copy exe to common folder, run application from common folder
Doesn't much matter how you reference using this configuration, the dlls will be picked up from the application folder and you're golden.
Continuous integration shouldn't care about your .csproj files. I guess they're MSBUILD files? Or something?
Don't use them for CI. They're junk. They accrue garbage because they make too many things invisible. Create a clean build structure that is independent of them, you'll be thankful you did. And then only check in a project file when you're adding something, and everyone else can update/merge. You don't need to have the same or even similar project files most of the time. On my team we don't even run the same version of VS across all workstations.