Tools
Ignore Files and Directories in Subversion
by Frank Kim on Mar.01, 2010, under Subversion
In the course of a project there are always files and directories that you don’t want to check in but which Subversion complains it doesn’t know anything about them. So it makes sense to tell Subversion to ignore them, in other words, keep quiet.
The mechanism for doing this works okay but I wouldn’t say it’s perfect.
This is how I do it one.
- Go to the directory where want to ignore a file or subdirectory.
- Issue the command
svn propedit svn:ignore .
- Your editor then will be launched and you can enter one line at a time those files and/or subdirectories you want to ignore.
some_file some_directory
- Commit your changes.
svn commit -–depth empty
Two things to notice.
-
--depth empty argument
only commit the propedit changes
- Committing your changes means everyone will end up ignoring these files and/or directories so make sure you are ignoring the right ones.
-
- If you don’t want to commit your changes you can revert them.
svn revert .
For further reading please see Ignore Files and Directories in Subversion.
Duplicating and Modifying Eclipse User Libraries
by Frank Kim on Aug.19, 2009, under Eclipse
Eclipse user libraries are wonderfully convenient ways of packaging together related JAR files. In my Eclipse I create user libraries for each ATG version I install. As a consultant I am always installing different versions and today I installed ATG 9.0.
Normally I use the GUI to create the user library for the latest ATG server. However I thought this is quite inefficient because I already have user libraries for previous versions of the ATG server. I just need to duplicate one of the other ATG user libraries and then tweak the duplicate to have the right path to the JAR files.
Unfortunately the Eclipse GUI does not provide a way to duplicate a library. So I searched in my workspace files and found in my .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs file the settings for all my user libraries.
I then edited that file and copied an entry for an older ATG library, org.eclipse.jdt.core.userLibrary.ATG\ 2007.1. I renamed it org.eclipse.jdt.core.userLibrary.ATG\ 9.0 and updated the paths to where ATG 9.0 is installed and I was done!
Perforce Review
by Frank Kim on Dec.30, 2008, under Perforce
You can have Perforce alert you about changes to sections of the depot.
To do this using the Perforce GUI.
- Go to User -> Edit <your name>…
- Add the branches in the Reviews section that you want to monitor. For example:
//depot/main/.../pom.xml //depot/main/com/betweengo/foo/... //depot/proj/.../bar/...
Thanks to fellow developer Bill Crook for the tip.
Update: Michael Delaney, Perforce guru, pointed out that this works only if a P4Review daemon is running which it is not by default.
Deconstructing software to find bugs
by Frank Kim on Oct.27, 2008, under Tools
In the September/October 2008 Technology Review I read a short article on Seth Hallem, one of the TR35. The subtitle of this article was “Deconstructing software to find bugs.”
As a graduate student at Stanford, Seth Hallem perfected an improved approach to finding bugs, called static analysis… Hallem developed algoritems to … examine only the most important combinations, allowing millions of lines of code to be examined quickly and efficiently. He cofounded Coverity in San Francisco.
Perforce Adding a Directory Tree
by Frank Kim on Oct.08, 2008, under Perforce
This article, Adding a Directory Tree, shows how to add a directory tree to your perforce repository.
- On UNIX, run:
find . -type f -print | p4 -x - addThe above
findcommand will find files, but will not find symlinks. Nevertheless, you can add symlinks to Perforce using a similar method. Be aware, however, that symlinks are read-only entites, and that editing a symlink is not the same as editing the file it references.To discover the symlinks that exist in your client workspace and assess whether or not you want to version them, run the following command from your client workspace root:
find . -type l -print (That's an "el" as in "l" for link)To add symlinks, run:
find . -type l -print | p4 -x - add -t symlink- On Windows, using the MS-DOS command shell, run:
dir /b /s /a-d | p4 -x - add
Perforce Branching
by Frank Kim on Sep.18, 2008, under Perforce
Perforce branching is pretty simple.
Say you want to create a branch called
//depot/fkim/foo
First you would add it to your client.
//depot/fkim/foo/... //fkim/foo/...
Next you would do an integration from where you wanted to cut the branch.
p4 integrate //depot/work/foo/... //depot/fkim/foo/...
Then you would submit the integration and the branch will be created and updated in your client work space.
p4 submit
Spaces, not Tabs
by Frank Kim on Aug.01, 2008, under Eclipse
The holy war about spaces or tabs continues and you can see all sorts of arguments for each side raging around the internet.
I prefer spaces because it’s a consistent format that remains the same no matter what you are using. With tabs things appear differently depending on how your editor or other program is configured. Plus the worst thing is when spaces and tabs get intermixed.
Arguments for tabs such as they take up less room or it’s easier to move around are in my mind weak. In this day of terabyte disk drive, file size differences between tabs and spaces are trivial and most of your disk space is taken up by images and binary files anyway. And being able to move around and format quickly is not an issue either with modern editors.
The two editors I use most are XEmacs and Eclipse. Below I describe how to use spaces for indents for each program.
In Emacs:
(setq-default indent-tabs-mode nil) ; Use spaces for indents except
; in buffers that already have
; their own local values for the
; variable.
In Eclipse:

Eclipse Ganymede
by Frank Kim on Jul.18, 2008, under Eclipse
I was about to write a post about how much I was starting to dislike Eclipse. Two years ago I was singing the praises of Eclipse but Eclipse Europa (version 3.3) in my opinion has been a disaster. It is incredibly slow, crashes often, runs out of memory, etc. I found myself at times using XEmacs instead because it was faster.
But today I installed Eclipse Ganymede (version 3.4) and so far life has been much better. It is much more responsive, it is not crashing, things are running smoothly. You can read about what is New and Noteworthy in Ganymede. The most exciting new feature to me is the Retain case of match when replacing, just like XEmacs.
Also I noticed that in my JBoss project, hot swapping of code is again working. I am not sure if this is because I upgraded to Ganymede or because I turned on “Build Automatically”. I suspect it might be the latter.
Maven Integration for Eclipse
by Frank Kim on Jul.18, 2008, under Eclipse, Maven
Previously I was using an old Maven integration for Eclipse, version 0.0.11, which I got from http://m2eclipse.codehaus.org/update. The plugin was horribly slow and seemed to sometimes interfere with my builds.
Today I upgraded to the latest, version 0.9.4, from http://m2eclipse.sonatype.org/update/ and things are moving much more smoothly. You can learn more at Maven Integration for Eclipse.
In Windows > Preferences > Maven I only turned on Download Artifact Sources and Download Artifiact JavaDoc. Download repository index updates on startup is on by default but I turned it off after receiving this advice from a fellow developer, Bill Crook.
It’s unclear to me how the m2 plugin uses the indexes so I don’t think I can answer you.
Enabling it causes the plugin to rescan the entire repository if i remember correctly. I personally am not willing to have Eclipse do a full file scan of the local repository each time i start for unknown reasons. if you don’t mind the incurred overhead, go ahead and enable it!
The Maven plugin has a nice dependency feature which Bill Crook explains well.
There will come a time when you need to work on two projects simultaneously. Additionally, there will probably be a dependency from one project to another. The key to doing this effectively is understanding workspace resolution. Workspace resolution is a concept of the m2eclipse plugin. The way this works is that the plugin scans all projects in your workspace and analyzes the poms. Based on group and artifact ID’s the plugin will know if there are interdependencies between your projects. Once the plugin has successfully detected the dependency between projects, you can jump from one project source into another when jumping into methods (via control-click or F3).
There is one important caveat to this, versions. In addition to looking at group and artifact ID’s, the m2eclipse plugin will look at versions to determine if the project for a dependency is in the current workspace. Because of this you must make sure the versions match. Let’s take the example of projects A and B in your workspace. Assume A has a dependency on version 2.0.0.1 of B. Now, if the version of project B in your workspace is 3.0-SNAPSHOT, workspace resolution will NOT work. Can you figure out how to make this work? If you guessed, update the pom of project A to depend on 3.0-SNAPSHOT, you are correct. The moral of the story is be aware of versions when trying to get workspace resolution working.
You will know that workspace resolution is not functioning properly if you see duplicates of the same class when doing searches with control-shift-t. This behavior makes sense when you think about it as Eclipse sees two of these classes in your workspace. For example, continuing with projects A and B as above, let’s assume there is a class Foo in project B. Eclipse would find class Foo in project B source (as java source in your workspace) as well as in version 2.0.0.1 of B (as a class file in jar dependency).
Now if someone would improve the Perforce plugin…
Eclipse memory settings
by Frank Kim on Jun.13, 2008, under Eclipse
Recently I have been having problems with Eclipse running out of memory.
Previously I had as my command line argument for Eclipse.
eclipse.exe -vmargs --Xmx512m
The double dashes were a problem, preventing Eclipse to properly load the correct memory settings from eclipse.ini.
I then removed the -vmargs –Xmx512m from the command line argument and instead modified eclipse.ini which is in the top level of the Eclipse installation. This blog article, Eclipse and memory settings, explains how you should put each argument on a separate line and that you can go to Help > About Eclipse Platform and then click on the Configuration Details button to check that Eclipse is running with the correct settings.
I changed this:
-Xms40m -Xmx512m
to:
-Xms120m -Xmx1024m
but I reverted back when I realized it was my original command line argument that was the problem.
I tried to use these settings as recommended in this forum, [news.eclipse.tools.jdt] Re: How to prevent out of memory errors?
-Xms120m -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M
But for some reason that kept crashing the Eclipse startup.

