Saturday, October 30, 2010
4 tips to get your support ticket worked pronto!
Thursday, October 28, 2010
ORM the Hibernate way -- on .Net!
Saturday, October 23, 2010
How to find which .jar a class is in (easily)
A Java developer feels this pain in a couple of ways:
- Compile time, manifested with errors such as "(ClassName) cannot be resolved to a Type" or "The import some.class.SoughtFor cannot be resolved".
- Runtime, where the errors will show themselves with messages like the all-time favorite "java.lang.ClassNotFoundException".
But what if you had a report like this? Wouldn't that be nice?
So what do you do then? Many coders start by trying to guess which .jars hold the missing classes, then add them to the classpath one by one. This can be an exercise in frustration, as often times .jar names give you little clue as to which classes are inside.
A second methodology developers sometimes use is the 'throw everything but the kitchen sink at it' approach, where they build huge classpaths loaded with every .jar they can find. This inexact coping mechanism obviously leads to bloat.
But wait! There is an exact way to cure the problem, and it's easy and open sourced! Here's how to do it:
1) Download and unzip JBoss Tattletale. It can be found here.
2) Make a run script for Tattletale.
3) Run the run script.
4) Read the report Tattletale makes for you. It's that easy!
The script is easy to write. It takes the form 'java -jar tattletale.jar DIRECTORY_TO_RECURSIVELY_SEARCH DIRECTORY_FOR_REPORTS.
Here's an example:
java -jar tattletale.jar /home/rick/Tools/JBoss/jboss-5.1.0.GA /home/rick/rpts
Then you just go to the reports directory and view the index. To find your classes in .jars, have a look at the 'Class Location' report. It'll tell you which jar holds the missing classes!
Tattletale has many more capabilities, which are well documented in the packaged docs. I hope you'll find this tool useful in your day-to-day development work.
Happy Coding!
Saturday, October 9, 2010
Solve your Java runtime mysteries easily with Byteman
Use the following to easily use Byteman on AS7, using the HelloWorld quickstart:
-- Script to attach, check, and submit rule -----
#!/bin/bash
export JBOSS_HOME=/home/rick/Tools/JBoss_Org/jboss-as-7.0.2.Final
echo $JBOSS_HOME
export BYTEMAN_HOME=/home/rick/Tools/MISC_TOOLS/byteman-2.0/byteman-download-2.0.0
export BYTEMAN_BIN=$BYTEMAN_HOME/bin
# Only install once.....
# $BYTEMAN_BIN/bminstall.sh -b -Dorg.jboss.byteman.transform.all $JBOSS_HOME/jboss-modules.jar
export QS_HELLOWORLD_TGT=/home/rick/Tools/JBoss_Org/jboss-as-quickstarts-7.0.2.CR1/helloworld/target/classes
# check it
$BYTEMAN_BIN/bmcheck.sh -cp $QS_HELLOWORLD_TGT RicksScript.btm
# add the rule
$BYTEMAN_BIN/bmsubmit.sh RicksScript.btm
-------The Rule. Check the arbitrary Java code used! --------------
RULE trace main entry
CLASS org.jboss.as.quickstarts.helloworld.HelloService
METHOD createHelloMessage
AT ENTRY
IF true
#DO traceln("entering createHelloMessage")
#DO traceStack("found the caller!\n", 100)
DO System.out.println("Hey, I'm random java code!");
ENDRULE
-------------
Have you heard of Byteman? It's sort of like AOP-lite. With a small script and a lightly doctored startup command, you can have x-ray vision into your Java applications. You don't even have to alter your source code, and it's easy to use.
- Make your application into a jar (using jar -cvf someJar.jar *.class, perhaps). This is done as a convenience to make it easier to put on a classpath.
- Make a Byteman script, telling it what you want to see.
- Make a command-line script to invoke your application.
#
java -javaagent:/home/rick/Tools/Examples/Byteman/byteman-1.3.0/lib/byteman.jar=script:clue_script.txt -classpath clue.jar Clue
Saturday, October 2, 2010
Voting now open for 2010 Open Source Awards
Open Source CMS Award
Every Content Management System (CMS) that is based on one of the Open Source licenses is eligible to participate for this category. Vote for your favorite Open Source CMS here.
Finalists:
- CMS Made Simple
- MODx
- mojoPortal
- SilverStripe
- XOOPS
Hall of Fame CMS
This category is reserved for those CMSes that have won the Overall Open Source CMS Award at least once in the past. Since the launch of the award in 2006, only Joomla!, Drupal and WordPress have won the Overall Open Source CMS Award, therefore, this category will feature only those three participants in 2010. Vote for your favorite Hall of Fame CMS here.
Finalists
- Drupal
- Joomla!
- WordPress
Most Promising Open Source Project
This category is for all Open Source projects, whose first release date is less than two years from 9 August, 2010. Vote for your favorite Most Promising Open Source Project here.
Finalists
- BuddyPress
- LiveStreet CMS
- Pimcore
- Tomato CMS
- WolfCMS
Open Source E-Commerce Applications
This category is reserved for the type of web applications that simplify buying and selling of products on the Internet. This will include complete e-commerce applications or frameworks designed for e-commerce. E-commerce modules or extensions to other systems can also be nominated. If a system is general purpose (like a CMS such as Drupal or Joomla!) the specific e-commerce functionality should be nominated, not the base system.Vote for your favorite Open Source E-Commerce Applications here.
Finalists
- Magento
- nopCommerce
- OpenCart
- PrestaShop
- Tomatocart
Open Source JavaScript Libraries
This category is reserved for JavaScript libraries, libraries of pre-written JavaScript controls which allow for easier development of RIAs (Rich Internet Applications), visually enhanced applications or smoother server-side JavaScript functionalities.Vote for your favorite Open Source JavaScript Libraries here.
Finalists
- Dojo ToolKit
- Ext JS
- jQuery
- Mootools
- Raphaƫl
Open Source Graphics Software
This category, as the name suggests, is for all Graphic Application Software that is used for graphic design, multimedia development, specialized image development, general image editing, or simply to access graphic files. It can also include graphics libraries, which use command line references or programming language inputs to design or edit graphics.Vote for your favorite Open Source Graphics Software here.
Finalists
- Blender
- Gimp
- InkScape
- jMonkeyEngine
- Scribus