15 Eylül 2011 Perşembe

bibsonomy

BibSonomy (http://www.bibsonomy.org/) is a successful bookmarking and publication sharing system.. In fact, i use the site to gather bibtex format reference entries..

13 Eylül 2011 Salı

logging the stacktrace

logging the stacktrace with log4j:


import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

// ......
static Logger logger = Logger.getLogger(MyClass.class);

// ......
public static void debugException(Exception ex) {
    //ex.printStackTrace();
    logger.error("An error occurred in MyClass.", ex);
}

frames in Latex

in order to print text inside a frame:



 \centering
    \fbox{
    \begin{minipage}{1.0\linewidth}
    The text that will be printed in frame goes here..
    \end{minipage}
    }



a few tips here: http://www.personal.ceu.hu/tex/spacebox.htm
http://en.wikibooks.org/wiki/LaTeX/Advanced_Topics
http://chenfuture.wordpress.com/2007/06/22/frames/

proguard ant task

proguard (http://proguard.sourceforge.net/) promises for  the following:

  • Creating more compact code, for smaller code archives, faster transfer across networks, faster loading, and smaller memory footprints.
  • Making programs and libraries harder to reverse-engineer.
  • Listing dead code, so it can be removed from the source code.
  • Retargeting and preverifying existing class files for Java 6, to take full advantage of Java 6's faster class loading.

here is code sample:
<target name="proguard" depends="jar">
<taskdef resource="proguard/ant/task.properties" classpath="${lib}/proguard-4.4.jar" />
<proguard configuration="${config}/obfuscate.pro">
<injar file="${build.dir}/prod.jar" />
<outjar file="${build.dir}/prod_obf.jar" />
<libraryjar refid="externals" />
</proguard>
</target>

checkstyle ant task

checkstyle (http://checkstyle.sourceforge.net/) is a tool that hels java code to adhere to coding standards.

for checkstyle ant task: http://checkstyle.sourceforge.net/anttask.html



<property name="build.checkstyle.config" value="${config}/sun_checks.xml" />
<property name="build.checkstyle.output" value="${build.dir}/checkstyle_report.xml" />


<path id="checkstyle.classpath">
<pathelement location="${lib}/checkstyle-5.3.jar" />
<pathelement location="${lib}/google-collections-1.0.jar" />
<pathelement location="${lib}/commons-beanutils-core-1.8.3.jar" />
<pathelement location="${lib}/commons-logging-1.1.1.jar" />
<pathelement location="${lib}/antlr-2.7.7.jar" />
</path>


<target name="checkstyle" depends="init">
<taskdef resource="checkstyletask.properties" classpathref="checkstyle.classpath" />
<checkstyle failOnViolation="false" config="${build.checkstyle.config}">
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
<formatter type="xml" tofile="${build.checkstyle.output}" />
</checkstyle>
</target>



about sun-checks.xml configuration file: http://checkstyle.sourceforge.net/config.html
here is a sample config file: http://code.google.com/p/checkstyle-idea/source/browse/trunk/src/main/resources/sun_checks.xml?r=120