Thursday, October 13, 2011

Landscape table or image in LaTeX

A thumb rule for landscape table or image in LaTeX:
  1. If you are using latex+dvips+ps2pdf, use the sidewaystable or sidewaysfigure or just sideway environment in rotating package.
  2. If you are on pdflatex, use the landscape environment in pdflscape package instead. sideway prodices a sideway table/figure, but has problem to produce a right landscape view of the page in the pdf file.
For the second option, you might also need the afterpage package to have a properly floating page for the landscape table/figure without a half-blank page before it. The environment is like
\afterpage{
\clearpage
\thispagestyle{plain}
\begin{landscape}
\begin{table}[htp]
% your table here
\end{table}
\end{landscape}
\clearpage
}

Wednesday, March 9, 2011

Authentication in embedded Jetty 7 server

A change in Jetty security from 6 to 7 is the introduction of LoginService, which was designed to replace UserRealm based approach. The usage of LoginService can be seen in the example SecuredHelloHandler and the test case of SecuredContentExchangeTest . Basically, the LoginService needs to be attached to a SecurityHander, and the SecurityHandler needs to wrap the handler that needs the authentication service. This can be done by either
securityHandler.setHandler(yourHandler);

or

ServletContextHandler theContext = new ServletContextHandler(handlerContainer, contextPath, sessionHandler, securityHandler, servletHandler, errorHandler);


Thursday, February 10, 2011

Aptana Studio 2.0.5 on Ubuntu 10.04

Aptana Studio 2.0.5 used to work well in my Ubuntu 9.04. It started to split out error message related to xulrunner after I updated Ubuntu to 10.04. When I removed the Apatana and its workspace, it even stopped to show the messages and silently crashed. After digging and trying for almost an afternoon, I fixed the problem by adding this line to the AptanaStudio.ini file:
-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner-1.9.2.13
You might change the path to whatever on your system. Note that there is a /usr/lib/xulrunner directory on my system, but that does not contain or link to the real literary files. I did not try if export the $MOZILLA_FIVE_HOME to the real xulrunner lib path will also work.