I'm currently working on a project. I've been running into a few issues with the e-mail functionality, I've made multiple attempts to fix the issue and the latest seems to have fixed the issue.
For each rewrite I've created a new class to hold the new code. This doesn't seem to be the best solution as each time I have to go through the code and track down the references to the class and update them, with each rewrite only the code for the actual sending of the email has changed, function inputs and names have been consistent.
I've looked up versioning but this hasn't been particularly helpful in providing a solution either granted most likely due to my own lack of knowledge on the subject. So here is what I'm looking for: to have one instance of the class with multiple versions preferably without all the old code in it to aid in reading. But I want access to the old versions so that if a function/feature was there previously and wasn't built into the current version I can see how it was implemented.
Versioning is exactly what you need here.
Have a look here, which gives you a brief introduction to subversion, one of the most popular versioning systems. You can either set up / use your own private subversion server, or if you project is open source use a number of free providers (such as Google code) who will provide versioning for you.
Other versioning systems exist other than subversion, such as git, mercurial, etc. - but subversion is arguably the most popular and a good starting point.
Are you using any IDE? Eclipse/Netbeans store the history of your file updates and you can always compare/replace from history.
Note: This is not a replacement of version control in any way and I would highly recommend that you explore open-source version control solutions. This would help you in the long run
Mercurial is the way to go. Seemless merging and integration with java and popular IDE's like Netbeans. You can't go wrong. From the very beginning of my programming experience I learned how to use Mercurial in a day.
Use version management tool likes as SVN or CVS.
Related
Issue
It is common in many projects that each developer uses the IDE of their preference, where the most common are Eclipse, Netbeans and Intellij.
In this case, they use that shortcut for formatting the entire file, and code formatting conflicts often occur, which makes revision implementation very difficult.
I've heard of plugin (EditorConfig) and XML config files to solve this issue and keep a unique formatting for the project, but have not yet seen this being used effectively.
Question
Is there a common practice for solving this problem, which is valid for these major IDEs? If possible, add an example configuration to the answer.
In terms of Java, there's Checkstyle
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard.
And plugins exist for both Maven and Gradle (which I'd recommend using for any Java project)
You may also integrate tooling into your source control that performs these tasks, but it would be preferred that developers check formatting before pushing
I'm quite new to android programming and I was wondering if there is a Save As button in Eclipse for the entire project instead of saving only 1 XML or Java at a time.
For example, when I work on Excel, sometimes I like to save different versions of Excel workbooks so that I can roll back if there is a problem. I want to do the same thing for Eclipse project files like Listv1, List v2, Listv3 etc.
I know you can use local history, but that is more for different versions of the XML and Java files.
I want to save different versions of project files onto my hard drive so that I can compare two different versions of my project.
Click on your open project in either the Project Explorer or Package Explorer windows. Then File/Copy (or Ctrl-C), then immediately File/Paste (or Ctrl-V). Your'll get a wizard to save the project under a new name.
You need a lot more than manual saves: Any software project of any significant size should be using a version-control system. The one that's become the main standard these days is git.
Providing this sort of multiple versioning is the baseline that a VCS does, and most also handle situations like branching, where you can be working on the new version of your program but still go back and fix a bug in the old one, then push out a fix to the existing users while you keep working on the new version.
Eclipse has very good integration via the eGit plugin, and you might also be interested in the git-flow branching system.
I don't think that eclipse has that feature, why not having a a version control system to track your changes? like Git or Svn, they are free and very powerful
For example, when I work on excel, sometimes I like to save different versions of excel workbooks so that I can roll back if there is a problem.
Learn to use a good source control (version control) system. That's a much cleaner solution than just keeping lots of different copies around. You should still be able to compare different versions easily - and you can experiment on different branches, etc. It'll also make it much easier to share your code with others, should you wish to.
Additionally, it's not clear whether you're currently just a hobbyist or not, but if you're intending to code professionally you'll definitely need to get used to source control systems. (Every software company worth their salt uses source control.)
You might want to look at:
Git (you might want to start at GitHub)
Mercurial
Subversion
(All of these are free, and have Eclipse plug-ins available.)
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am working on a Java project together with a collaborator, and we are both using the Eclipse editor. What I want to do is to be able to share the .java files with him so that we can both edit it separately but see what has the other has written. Currently, I am doing this is an ad-hoc way by sharing a Dropbox folder that contains the project. However, this approach does not work well because he is using a different version of Java (as he runs a Mac while I am using Windows). For me to run the project, I would have to clear all the .class files that he has created which will appear on my computer since Dropbox just shares all the files.
I have heard of CVS as a way to manage file sharing among developers, but it sounds like a lot of work. I don't know for example how to get a CVS server or what to do to get it to work. Is there an easy and straightforward way to enable us to work together on the same Java project? Is GitHub the answer?
This is definitely the job of source control, as other answers have mentioned, Git or SVN are probably your best choices. Git is the newer one and is gaining a ton of popularity (probably thanks to GitHub).
GitHub is pretty easy to learn and can even take care of a lot of the more difficult tasks for you with their new GitHub for Windows client. They also have a GitHub for Mac client. Once you are more familiar with the tool you can get the EGit plugin for eclipse so you can control the source control directly from your IDE.
Additionally, GitHub created an online interactive tutorial for learning git.
As for clearing out class files (and also your .settings and .project and .classpath files from eclipse), you can instruct git to ignore these types of files using a .gitignore file. You can find templates for various languages (including Java) here.
you could spent the time to learn git at: https://help.github.com/articles/set-up-git
it's a very valuable tool and once you get used to it it will be very easy to share code.
Or better yet, Mercurial. It follows the same approach as Git, but is way simpler and works without hassle. To start a repository within the current directory, just run:
hg init
Have a look at the documentation for more information.
I recommend "Subversion"
Google it and look at the information.
You can easily check out files and check in.
I wish you luck.
Depending on what your future plans are the Git or Subversion would be fine. I finally made the switch to Git after years of using SVN.
Note that in addition to Github (which is great) there are also some other repository hosting services, some of which offer free "personal" accounts (most make your code public, but I think a few still give you a limited amount of space for free).
CVS is getting old and people are moving out of it to other source code control tools
The most famous tools are SVN and Git. There are other tools but less famous I believe
You definitly need a software revivision tool if you are going to work in a team(or even alone for that matters), as it marks the changes that have been made, when and by whom, etc...
google code for example offers an easy way to setup your svn repository in one minute. there are also alot of companies offers such a service online for free or for small money, depending on your need. So if you just need a sandbox, then setup a svn on google code and try it out
a code revision tool is almost a must for every programmer
good luck
I have a java spring GWT web application. I need to use a profiler to view why is a certain function that slow (on server)... After some searching, seems that insight is a good way... tried it and it works... what I did is create a tc server instance (developer edition) with insight and add the project to it. It works.
The problem here is that I use maven plugin "org.codehaus.paranamer", that is a plugin that I use to get function paramater names... It works post-compilation to add a special private field in the class that holds the parameters names.
This is a problem with insight since it seems that it modifies the code too and that it works on the source code not the compiled version in the target folder.
What I can do to make this work? FYI, all I need is profile the app.. not necessarily with insight....
Edit:
I ended up using visualvm... It can help with profiling the app on the cpu level and the memory level... That is the way I can use the common remote profiling mechanism jerry was talking about.
For profile of JAVA apps(including tomcat instances), I strongly recommend the TPTP(Eclipse Test & Performance Tools Platform). You can read a lot here:
http://www.eclipse.org/articles/Article-TPTP-Profiling-Tool/tptpProfilingArticle.html
Especially for TPTP working with tomcat instance:
http://www.deepakgaikwad.net/index.php/2009/02/10/tutorialprofiling-with-tptp-and-tomcat.html
Some of the information in the above article may be outdated, but main workflow is the same.
For commercial profilers, I will recommend yourkit profiler: http://www.yourkit.com/
I don't know if there is a trial edition available now, but years ago, this profile is more user friendly than TPTP.
Disclaimer: I've never used the technique which is described below. That's why there may occur some mistakes or misunderstandings in its description.
I heard that some teams (developers) use 'pre-configured' tomcat. As I understand they add different jars to tomcat \lib folder and do something else.
Once I've read a thread in a java forum where one developer wrote something about recompilation (or reassembly?) of tomcat for certain needs.
Just yesterday I heard a dialog where one developer sayd that his team-mates were not able to deploy the project until he would give them configured tomcat version.
So, I wonder, what is it all about and why do they do it? What benefits can they gain from that?
Open source projects, always have been an space for customizations (I believe, that's something of its charm), and I think it's acceptable to modify Tomcat for very specific in-house requirements.
But in general I would recommend to avoid a solution that requires hard modifications of open source tools -probably there is another way to do what you want using the existing ; ) (this do not apply for general accepted changes i.e. community Addons, bug fixes, and all the stuff you publish in the project spaces that are accepted and made part of the final solution).
About external lib, I would mentioned them in the project README as platform requirements. so to have a pre-configured server it's not that crazy. in fact it can save you some time, but it's a bonus. you should mention your dependencies somewhere anyway : )
Hope it helps.
Using a customized version of Tomcat could make upgrading very difficult. The benefit of having an application that does not require a specially configured server is that you can easily move to a new version or even move to an entirely different app server (e.g. Jetty, GlassFish)
I'd also point out that you do not specify the context of the changes. The special configuration may not have been application specific, but was required for security settings, compatibility with the web server being used, etc. You should talk to the developer's in question and learn more about why they require the specialized configuration.
This is the mechanism necessary to provide e.g. JDBC pools and objects over JNDI since that requires it to be in the Tomcat classloader. That is a necessity.
It may also be used to allow multiple deployments to share the same single jar file instead of having it in each WAR file. That is in my opinion generally a bad idea which should be avoided unless absolutely necessary. Keep to standard mechanisms if at all possible.