Here are some nice programming tools for Ubuntu Linux.
File Comparison (Meld)
UML Modelling (Umbrello)
Find in files (GEdit)
Find memory leaks (valgrind)
Optimize for speed (kprof and oprofile)
Other scripts (Command Line)
Xubuntu editor
Meld
Meld is a very nice file and directory comparison tool. It will display a tree view
of directories, and allow clicking into the files. It will allow moving either
differences by individual differences within files, or by moving entire files or
directories.
UML Modelling
The Umbrello program can read source code and create UML drawings. It is also possible
to make drawings and create source code. The easy way to get it in Ubuntu is to use
the synaptic package manager and get the kdesdk package. This means that the recently released
version of the KDE SDK for Windows also has Umbrello built in. The download and
usage from Windows was very easy. I used this on Vista at work.
The class diagramming seems to work pretty well. Both making classes, and reading classes
from source code.
The following notes apply to version 2.0. I have compared to MagicDraw and Rational/IBM
and this tool is useful for doing single time code generation from initial objects, and then
reverse engineering from code to update the drawings. I don't plan to do multiple code
generation passes.
Sorry to have to say this, but there have been frequent crashes, so save often. Just
note that I have also had crashes (but fewer) in the 2007 version of Rational tools.
For some reason, the diagram export doesn't work from the GUI. But there is a command
line switch (--export) that works fine. Just use "umbrello --export png [project].xmi.
The command line switch doesn't work in Windows, so at work, I am doing a print screen,
importing into Paint, and saving as PNG. Definitely ugly, but I do it less than daily
just to update documents periodically.
The main menu in Gnome doesn't work properly. If the menu is displayed from the right
side, then it is possible to use, but it is not possible to click directly on File, Edit
or half of Diagram.
If there are extra generalizations in the class diagram, the sequence diagrammer
may crash when a message is added. The only way I could find to fix this was to delete all
of the UML:Generalization elements from the XMI file, and then add them back using Unbrello.
This can also mean that remnant links will also generate extra code, and so either remove
the junk generated code, or edit the XMI.
I couldn't find the place to specify navigability on aggregations. It it is not limited,
then an extra member will be generated in the code.
The enum types do not generate code that I could find. It doesn't seem like the reverse
generation will generate enums.
Adding messages in sequence diagrams can cause methods to be added to the class diagram,
even if the methods already exist in the parent super classes. The workaround that worked
ok for me was to turn off the show operations in the class diagram. This wouldn't work in
some cases, but was ok for what I was doing. If they are deleted from the classes, then
the sequence diagrams get messed up.
There is no way to choose between showing an aggregation/composition as a link or a member.
Sometimes it seems like they display both, although I haven't figured out what sequence
causes this. It seems to be related to if the class is on the diagram initially or not.
Moving messages up and down in sequence diagrams is sometimes difficult. It seems
like they must be moved slowly or something. Usually it is possible to get them ok,
but may require several tries. It is sometimes related to number of items seleccted, so
if too many move at once, click on the background.
Code generation generates destructors with the wrong character. There doesn't appear
to be a way to specify include files. These things mean that the code must be edited.
I didn't fine a way to specify guards on sequence diagrams. This must be done using
notes.
Find in files
One of the missing features of Gedit is the "search in files" functionality.
This can be simply added using the following.
Open Gedit and go to Edit/Preferences/Plugin and select external tools.
Press "Configure plugin".
Press "New Tool" and add a new tool with the following.
The following script will display optimization information in a graphical interface.
I am using QT, so some of these notes are specific to QT.
#!/bin/sh
# depends on packages: oprofile, kprof
# this also requires /usr/bin/opcontrol first line to be changed to #!/bin/bash
#To compile and link with profiling enabled, add these lines to the .pro file:
#QMAKE_CXXFLAGS_DEBUG += -pg
#QMAKE_LFLAGS_DEBUG += -pg
#Rebuild the application in debug mode:
#$ qmake -config debug
#$ make clean
#$ make
#Run the application as usual. A profile data file called gmon.out is created
#when the application exits normally (eg. it doesn't crash). Finally, you must
#run gprof to analyze the profile data:
#$ gprof executable-file > outfile
sudo opcontrol --no-vmlinux
#sudo opcontrol --start-daemon
sudo opcontrol --start
bin/testchar manyreps
sudo opcontrol --stop
gprof bin/testchar >bin/profreport.txt
mv gmon.out bin
#opreport --symbols --debug-info --output-file ./opreport.txt
kprof -f bin/profreport.txt
#sudo opcontrol --start ; ./testchar --run ; opcontrol --stop
#sudo opcontrol --shutdown
Other scripts
This will find and delete all temporary files starting from the parent directory.
Simply name the file removetemps.sh, and in Nautilus (File Manager), remember to
go to the properties page and change the permissions so that the Execute flag is set.
#!/bin/sh
find ../ -name '*.*~' -exec rm '{}' \;
The following will delete all files in all bin directories.
find ../ -wholename '*/bin/*' -exec rm '{}' \;
The following will change spaces to tabs in an entire directory.
On Xubuntu, I am using the built in MousePad editor. This editor will allow jumping
to a line, but does not appear to display the line numbers. One other problem is
that space/tab handling is different than GEdit. I don't think I will find a good
lightweight editor for all platforms. Sorry, no VI for me at this time.