Force Netbeans to generate partially-qualified javadoc - netbeans

several methods I have return Map objects like (partially-qualified)
Map<Integer,String>
which turn out in the NetBeans (7.0.1) generated javadoc as fully-qualified:
java.util.Map<java.lang.String,java.lang.Integer>
Do you know whether it's possible (and how) to tell NetBeans javadoc generator to use partially-qualified class names? Through Google I was only able to find related Oracle's naming convetion but there seems to be no useful option switch.
Thanks in advance!

I've resolved to post-production modification of javadoc generated files with this simple grep & sed command. It is platform dependent though (*nix os):
For example, to hide all "java.lang" package prefixes, run this in javadoc directory:
grep -rl "java.lang." ./ | xargs sed -i 's/java.lang.//g'
And in the same fashion with "java.util." package:
grep -rl "java.util." ./ | xargs sed -i 's/java.util.//g'
Hope it helps someone out there.

Related

How to download binary files from a public github repository through the command line?

I'm trying to work through this docker-zfs plug in: https://github.com/TrilliumIT/docker-zfs-plugin. I'm stuck at this line: Download the latest binary from github releases and place in /usr/local/bin/ .
How does one do such a thing? I've done through the whole page, and I don't see any mention of binary files/a link for a release. I've looked at other pages to download from Github repositories, but I don't have any authentication so they didn't seem applicable. I looked at this and tried to make it work, https://geraldonit.com/2019/01/15/how-to-download-the-latest-github-repo-release-via-command-line/ , but something about the link formatting didn't seem to work. This must be really obvious but I don't see what I am missing.
This is what I tried:
LOCATION=$(curl -s https://github.com/TrilliumIT/docker-zfs-plugin/releases/latest
| grep "tag_name"
| awk '{print "https://github.com/TrilliumIT/docker-zfs-plugin/releases/latest" substr($2, 2, length($2)-3) ".zip"}')
; curl -L -o . /usr/local/bin/
(But I'm not sure this is what I need, and the link doesn't exist either. There must be a better way of doing this?)
Ok so I actually figured this out, it was simpler than I was doing:
wget https://github.com/TrilliumIT/docker-zfs-plugin/releases/download/v1.0.5/docker-zfs-plugin
sudo mv docker-zfs-plugin /usr/local/bin/

Determine if app is Wayland or X client

Is there a way to determine if an arbitrary app is an X client or a Wayland client (or neither) from the command line without fully launching it?
You can run ldd on the binary to check which libraries it links against. If it has "libwayland-client" you're probably looking at a Wayland client. For X you need to look for "libX11" or "libxcb".
To expand on the excellent answer given by #Alexander Sukhoverkhov what needs to be done is:
cd /usr/bin
ldd $application_name | grep wayland
Furthermore, to check which binaries have wayland support you could try:
cd /usr/bin
find . | xargs ldd | grep wayland -B 55
The above is not really very clean but it works. You can further pipe it to a file and then use vim to navigate.
cd /usr/bin
find . | xargs ldd | grep wayland -B 55 >> candidates
vim candidates
# Use vi movement
The -B flag stands for before and helps to print the binary name.

Batch rename with command line

I have some files: file1.txt, file2.txt and I would like to rename them like this: file1.something.txt and file2.something.txt
I looked for some similar questions and I come up with this:
for i in file*.txt; do echo mv $i file*.something.txt; done
but unfortunately the output is:
mv file1.txt file*.something.txt
mv file2.txt file*.something.txt
and therefore only 1 file is created.
Could please somebody help?
(I am using a macbook air, I am not sure if this is relevant)
Thank you very much
Try this :
rename -n 's/\.txt/something.txt' *
(remove -n switch when your tests are OK)
There are other tools with the same name which may or may not be able to do this, so be careful.
If you run the following command (GNU)
$ file "$(readlink -f "$(type -p rename)")"
and you have a result like
.../rename: Perl script, ASCII text executable
and not containing:
ELF
then this seems to be the right tool =)
If not, to make it the default (usually already the case) on Debian and derivative like Ubuntu :
$ sudo update-alternatives --set rename /path/to/rename
(replace /path/to/rename to the path of your perl's rename command.
If you don't have this command, search your package manager to install it or do it manually
Last but not least, this tool was originally written by Larry Wall, the Perl's dad.

Need to find list of scripts that uses a certain file

I have a file named "performance". I need to know which scripts use this file.
I don't believe there is a straight forward way of listing files used by scripts. You will have to run grep in combination of find to check if the script contains the name of the file that you want to check for. Knowing the exact name of the file will help. Using words like performance might end up grepping files that uses that word in comments.
find /path/ \( -name "*.sh" -o -name "*.pl" \) -type f -print0 | xargs -0 grep "performance"
If you're on linux, then you may install and configure auditd to watch for accesses to a particular file.
You can use the -r option to recursively grep through all sub-directories and find text. The syntax is as follows:
grep -r "performance" /dir/

sed: illegal option -- i on CentOS5

Does anybody know which version of sed is required to get option -i to work? I am on CentOS5 and I am getting this error.
If you're going to be using -i with sed you're doing it wrong. sed is a stream editor and it should be used to edit streams, not files, as -i wants to do.
If you want to edit a file, you should be using ed. ed is a line editor and it should be used to edit files. IMO, that's the tool you want to be using.
btw, -i is a GNUism. from the wikipedia:
GNU sed added several new features. The best-known is in-place editing of files (i.e., replace the original file with the result of applying the sed program), which was later included in BSD sed too. This feature is nowadays often used instead of ed scripts: for example,
I don't think you can get -i to work then.
I think this other SO question may help you out:
sed -i + what the same option in SOLARIS
Perhaps the solution isn't as nice as sed -i, however.