28 Temmuz 2011 Perşembe

a simple log4j example

the properties file is something like that:

log4j.rootLogger=DEBUG


log4j.appender.SampleAppender =org.apache.log4j.FileAppender
log4j.appender.SampleAppender .File=Sample.log
log4j.appender.SampleAppender .layout=org.apache.log4j.PatternLayout
log4j.appender.SampleAppender .layout.ConversionPattern= [%t] %-5p %c{2} %d %x - %m%n


log4j.logger.org.sample=,SampleAppender 





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


public class Sample {


    static Logger logger = Logger.getLogger(Sample.class);



    public static void debug(String message, boolean debugModeOn) {
        if (debugModeOn) {
            PropertyConfigurator.configure("log4j.properties");
            logger.debug( message);
        }
    }




log4j.properties file must be in classpath..
for log format: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html

26 Temmuz 2011 Salı

how to use subfigure feature in Latex

In order to use subfigure feature in Latex:
\documentclass{article}
\usepackage[pdftex]{graphicx}
\usepackage{subfigure}

To reference subfigure do Figure ~\ref{fig:second}

\begin{figure} [htp]
   \begin{center}
    \subfigure[My First Figure]{\label{fig:first}\includegraphics[scale=0.30]{first.PNG}}
    \subfigure[My Second Figure]{\label{fig:second}\includegraphics[scale=0.30]{second.PNG}} \\
  \end{center}
  \caption{MAVIS Interfaces}
  \label{fig:edge}
\end{figure}

24 Temmuz 2011 Pazar

writing XML code in Latex

two ways to produce XML code in Latex:

1st way:
input:


\begin{tabbing}
    \\ $<$Sem\=anticBase id="Biglia\_Anderlecht\_58\_4" xsi:type="AgentObjectType"$>$ \\
    \>  $<$Lab\=el$>$ \\
    \> \>      $<$Name /$>$ \\
    \>    $<$/Label$>$ \\
    \>    $<$Def\=inition$>$ \\
    \> \>      $<$FreeTextAnnotation /$>$ \\
    \>    $<$/Definition$>$ \\
    \>    $<$Med\=iaOccurrence$>$ \\
    \> \>      $<$Med\=iaLocator xsi:type="TemporalSegmentLocatorType"$>$ \\
    \> \> \>      $<$Med\=iaTime$>$ \\
    \> \> \> \>          $<$MediaTimePoint$>$58$<$/MediaTimePoint$>$ \\
    \> \> \>      $<$/MediaTime$>$ \\
    \> \>      $<$/MediaLocator$>$ \\
    \>    $<$/MediaOccurrence$>$ \\
    \>    $<$Relation type="urn:...:agentOf" target="Corner" /$>$ \\
    \>    $<$Relation type="urn:...:memberOf" target="ANDERLECHT" /$>$ \\
    \>     $<$Age\=nt xsi:type="PersonType"$>$ \\
    \> \>      $<$Nam\=e$>$ \\
    \> \> \>        $<$GivenName$>$ Biglia $<$/GivenName$>$ \\
    \> \> \>        $<$FamilyName /$>$ \\
    \> \>      $<$/Name$>$ \\
    \>    $<$/Agent$>$ \\
      $<$/SemanticBase$>$ \\
    \end{tabbing}


output:

















2nd way is by using listings style..

18 Temmuz 2011 Pazartesi

how to change web service endpoint at run time

In order to change web service url endpoint at runtime, change call code as follows:
try { // Call Web Service Operation
           MyServiceService service = new MyServiceService();
           MyService port = service.getMyServicePort();
            BindingProvider bp = (BindingProvider)port;
            bp.getRequestContext().put(
                    BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                    "http://localhost:8080/MyServiceService?wsdl");
           
            java.lang.String username = "admin";
            java.lang.String password = "admin";

            ResultType result = port.myServiceOperation(username, password);
     
        } catch (Exception ex) {
             //..
        }


7 Temmuz 2011 Perşembe

error during deploying ws to glassfishesb v2.2.

My environment is as follows:
- The server is on a virtual machine (played by VMWare player).. Operating system of server is OpenSuse 11.4, os of client is OpenSuse 11.2
- The application server is installed with GlassfishESB v2.2 (https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_SMI-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=GFESB-22-G-F@CDS-CDS_SMI)


The scenario is :
1) WS project is successfully deployed.
2) Bpel module (CA project with Bpel Module) is successfully deployed.
3) When i tried to redeploy WS project i got this error:


 constituent CLs :: 
 :: asimpl :: optionalChain
 was requested to find class com.sun.enterprise.management.deploy.DeployThread.LogStrings after done was invoked from the following stack trace
java.lang.Throwable
        at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:708)
        at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:628)



it may be about this: http://java.net/jira/browse/GLASSFISH-11715

My workaround:
When i undeployed bpel project and redeployed ws project afterwards, it worked for me..

5 Temmuz 2011 Salı

VMWare player error: Could not open /dev/vmmon

i got the following error when i tried to reopen vmware on Opensuse 11.2 host:

1. error screen
Could not open /dev/vmmon: No such file or directory.
Please make sure that the kernel module `vmmon' is loaded.
2. error screen
Failed to initialize monitor device.
3. error screen
The virtual machine is busy.


here (http://communities.vmware.com/thread/245998) explains the reason as :
From what I've read, this happens on OpenSUSE. VMware comes with some pre-built binaries which somehow don't work on this OS. So you're deleting them, and by running that tool they are built again, this time for your system.

and the solution is to execute following commands:
sudo mv /usr/lib/vmware/modules/binary /usr/lib/vmware/modules/binary.old
sudo vmware-modconfig --console --install-all --appname="VMware Player" --icon="vmware-player"

1 Temmuz 2011 Cuma

VMWare kernel module updater at startup

after accomplishing this (http://hilaltarakci.blogspot.com/2011/07/vmware-installation-error-unknown.html), this time kernel module updater dialog comes at startup (with an empty location field).

according to http://tr.opensuse.org/Setting_up_VMware_on_SUSE_Linux, i installed those with yast:

gcc
gcc-c++
kernel-source
kernel syms
make


btw, learning suse version: more /etc/SuSE-release

This time there was a conflict between wanted kernel(2.6.31.14-0.4) and my kernel(2.6.31.14.-0.8). (kernel version mismatch) So, i downgraded the kernel to 2.6.31.14-0.4 and problem solved..

VMWare installation error: unknown encoding: ISO-8859-1

During VMWare installation on opensuse 11.2, i got this error:


SyntaxError: ('unknown encoding: ISO-8859-1', ('/usr/lib/vmware-installer/1.1/python/lib/sqlite3/__init__.py', 0, 0, None))



installation file is: VMware-Player-3.1.4-385536.x86_64.bundle

http://www.slax.org/forum.php?action=view&parentID=37046 says that this error is due to system local settings is Turkish.

sudo LANG=en ./VMware-Player-3.1.4-385536.x86_64.bundle  command worked for me..