While doing a bug hunting we needed to find a file containing a certain string and we did not know where to look for it. At one stage of "file hunting" we needed to be able to search for the file in jars (Java Archives). Thus in searching for it we came up with this shell script; using this script not only can we find jars containing certain filename but also search file content to get results. Lets take three use cases - "I want to find jars that contain .properties file", "I want to find jars containing .properties file containing the word com.smartitengineering" and "I want to find jars, whose name has smart, containing .properties file containing the word com.smartitengineering". Using the script all these use cases can be achieved by using the following commands respectively:
./search-jar.sh - /home/user/ .properties -
./search-jar.sh - /home/user/ .properties com.smartitengineering
./search-jar.sh *smart*.jar /home/user/ .properties com.smartitengineering
The command takes exactly 4 arguments - jar_filename_pattern, search_dir_path, search_file_name and content_to_search. If jar_filename is "-" than it will search within all jars within search_dir_path. If content_to_search is "-" it will not search for content, but rather jars with certain filename.
As the script is in open domain I would appreciate if users would make their own edit and submit or request for features through this post's comments.
Ubuntu: Getting Java Applets to work with Firefox
I was having problem to get Applet working in Firefox, primarily because I work with manually installed JDKs (that is not downloaded using apt-get). I did the following to get Applets working going through the following procedure.
locate libjavaplugin_oji.so
After I do this I will get the list of this file present in my machine. In my case one of the paths was -
/opt/jdk1.6.0_01/jre/plugin/i386/ns7/libjavaplugin_oji.so
Now I did the following and restarted my machine -
sudo ln -s /opt/jdk1.6.0_01/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins/libjavaplugin_oji.so
After this I got applets to work in Mozilla Firefox. Just for fun delete the symlink and without restarting the browser check whether you can see the applet or not :).
locate libjavaplugin_oji.so
After I do this I will get the list of this file present in my machine. In my case one of the paths was -
/opt/jdk1.6.0_01/jre/plugin/i386/ns7/libjavaplugin_oji.so
Now I did the following and restarted my machine -
sudo ln -s /opt/jdk1.6.0_01/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins/libjavaplugin_oji.so
After this I got applets to work in Mozilla Firefox. Just for fun delete the symlink and without restarting the browser check whether you can see the applet or not :).
Propagating GIT commands to its submodules
GIT submodules is an idea (of many) that actually played an extremely important role in me moving to GIT. As a new user I started playing around with GIT and I noticed that GIT commands executed on the parent module is not propagated to the child modules. In some use cases it would be extremely useful (at least for me) to be able to be propagate a command from the master module to all its child at all depth. I wrote this bash shell script to simply propagate commands from parent to its child. To use this script you can simply do the following (I am assuming that the TXT will have the name git-modules and will be an executable in $PATH):
I would really appreciate/welcome criticism, feedback and addition to the script. I will be publishing it to the repo.or.cz tomorrow after a little bit more testing.
for: git-pullBasically any git-X command can be simply be done as "git-modules X args-as-usual".
do: git-modules pull
for: git-status
do: git-modules status
for: git-commit -a -m "This is a test commit"
do: git-modules commit -a -m "This is a test commit"
for: git-checkout master
do: git-modules checkout master
I would really appreciate/welcome criticism, feedback and addition to the script. I will be publishing it to the repo.or.cz tomorrow after a little bit more testing.
GIT: Starting using GIT as your SCM
I am a user of SVN and was a fan of it as well. But the following video demonstrated some requirements of SCM which I liked a lot Especially as I want to work distributed, offline, modular and essentially fast GIT came to me as a gift and I want to share it with everyone. This Tech talk from Linus actually convinced me to take a deep look at GIT.
Then this video (which for some reason YouTube does not allow to embed) actually helped me understand more about how GIT works and some tips to work better with GIT.
This image could be helpful enough to have it beside your desk and it also has a larger resolution one if you want it. These images and other documentation are available at the GIT Wiki site. If you are looking for a extended cheat sheet you can find it here. If you are looking for the manual its here and you might also find the "Everyday GIT ..." page helpful. Some useful How-To s can be found here. If you are looking for how to setup a hook, have a look here; you can also simply find those scripts doing locate hooks in your linux box.
I have developed such likings towards GIT to the extend that I have started writing a Maven2 SCM Provider for GIT (using the Mercurial provider as example). Once I am done with it I will also be writing a NetBeans VCS Plugin again in light of the Mercurial plugin (if no VCS plugin for GIT is available in NetBeans prior to that).
Then this video (which for some reason YouTube does not allow to embed) actually helped me understand more about how GIT works and some tips to work better with GIT.
This image could be helpful enough to have it beside your desk and it also has a larger resolution one if you want it. These images and other documentation are available at the GIT Wiki site. If you are looking for a extended cheat sheet you can find it here. If you are looking for the manual its here and you might also find the "Everyday GIT ..." page helpful. Some useful How-To s can be found here. If you are looking for how to setup a hook, have a look here; you can also simply find those scripts doing locate hooks in your linux box.
I have developed such likings towards GIT to the extend that I have started writing a Maven2 SCM Provider for GIT (using the Mercurial provider as example). Once I am done with it I will also be writing a NetBeans VCS Plugin again in light of the Mercurial plugin (if no VCS plugin for GIT is available in NetBeans prior to that).
Retreiving all classes in a package
Straight to the point - I had to list all ReadOnly attributes for my domain objects as I had to list them in the office Wiki. I had several of them and doing that manually would be tiring (not to mention that I actually do not like documentation that much), I had to find a shortcut and only way is to use reflection; the next question was - how can I just simply mention the package and it will do the rest for me, so after Googling I could not find a solution to my liking so I thought of writing one myself and it took 10~15 minutes to come up with this piece of code.
I did the following with it and it worked nicely for me -
I did the following with it and it worked nicely for me -
javac GenerateProperties.javaIf you are running your program from IDE, if you have several modules in your classpath (i.e. their target/classes/) and/or zip/jar(s) it will also search through them to list the methods. I am thinking of making a small framework, or API, out of it. I would like some enhancements on this code, please feel free to send them to me.
java -cp /opt/jdk1.6.0_01/jre/lib/rt.jar:./ GenerateProperties
SMTP setting for GMail in Evolution

This post of mine involves the least technical depth probably :), it is mainly about configuring SMTP for GMail with Evolution mail client (not that it could not be figured from the image). As GMail users know GMail does not use the default SMTP port (25), the custom port number has to be mentioned in the configuration and though there is no field labelled as Port, but users can easily set the port number as I did. Please see the red border region for it in the image - server-address:port. If required port number can also be provided in similar fashion for incoming mail server.
Modular project development - with Maven and GIT
For sometime I have been searching for a combination for Multi-Module project development with SCM and Project Build tool. After using and testing some tools I have settled GIT and Maven; actually honestly speaking I have quite impressed by GIT. Though the main repository for my projects will be either CVS and SVN because dev.java.net provides those only but the developers will be requested/encouraged to use GIT (through online collab) as their local/team SCM/VCS. As result of my conviction I have decided to start a plugin for GIT-NetBeans integration as well; Almighty willing. At first I will use it for the DatabaseReport and JAIN SIP adapter projects. Everyone interested can join in any of the 3 projects (including the GIT-NetBeans Plugin).
NetBeans RCP development with Maven
I have been wanting to work with NetBeans RCP for quite some time now, but I felt that resources were lacking; then came along API changes for NetBeans 6.0 Platform and I felt there is a lot of improvement in it, along with its platform home, the excellent RCP book and Maven integration for plugin/suite/Rich Client Application development (I personally tested it whether it works or not and it does smoothly except that when I was reading it Figure 4 and Figure 6 were in opposite places), now I reckon NetBeans RCP as a force. The biggest advantage of NetBeans RCP that actually initially dragged me to NetBeans was the JavaHelp integration.
I just wish NetBeans also support(s)/ed GIT. Actually I am planning to add support for it in NetBeans.
I just wish NetBeans also support(s)/ed GIT. Actually I am planning to add support for it in NetBeans.
Subscribe to:
Posts (Atom)