Monday, March 28, 2011

URL rewriting tutorial

a very good apache url rewriting tutorial is here.

Monday, March 7, 2011

latex: arabic footnotes in minipage environment

To get arabic footnote markers in the minipage environment renew \thempfn command:

\begin{minipage}{\textwidth}
   \renewcommand{\thempfn}{\arabic{mpfootnote}}
   ...
\end{minipage}

Saturday, February 26, 2011

latex warning output

To make latex print an warning at output one can use:
  • \@latex@warning{My message}prints "file.tex:10: My message on input line 10"
  • \@latex@warning@no@line{My message}prints "file.tex:0: My message"

One can define a \todo command to get warnings about uncompleted sections. The following todo command will print a
TODO...
in the PDF and the warning message passed as a parameter \todo{Finish Thanks section!}

Code for pasting in LaTeX package(.sty file)

\makeatletter
\newcommand{\todo}[1][]{\@latex@warning{TODO #1}\fbox{TODO\dots}}
\makeatother

Friday, February 25, 2011

bugfix> remove unwanted spaces in tokenizer package

As notice here \GetTokens inserts unwanted spaces. The bugfix is to use the following code instead of just "\usepackage[trim]{tokenizer}":
\usepackage[trim]{tokenizer}  
 
\def\SH@GetTokens#1,#2\@empty{%
    \def\SH@token{#1}%
    \ifx\SH@trimtokens\SH@true% strip spaces if requested
        \TrimSpaces\SH@token%
    \fi%
    \SH@DefineCommand{\SH@FirstArgName}{\SH@token}%
    \SH@DefineCommand{\SH@SecondArgName}{#2}%
    }
\def\SH@CheckTokenSep#1,#2\@empty{%
    \def\SH@CTSArgTwo{#2}%
    \ifx\SH@CTSArgTwo\@empty%
        \edef\SH@TokenValid{\SH@false}%
    \else%
        \edef\SH@TokenValid{\SH@true}%
    \fi%
    }

I will report this bugfix to the developer Sascha Herpers

Thursday, February 10, 2011

get rid of latex badboxes on framed figures

If you include in a LaTeX document a graphics file with a frame
\fbox{\includegraphics[width=\textwidth]{file.png}}
you will get a badbox warning. The solution is to substract twice the size of the frame:
\fbox{\includegraphics[width=\textwidth-\fboxrule-\fboxrule]{file.png}}
For multicolumn:
\fbox{\includegraphics[width=\columnwidth-\fboxrule-\fboxrule]{file.png}}

Sunday, January 30, 2011

virtual flying birds

I have created a 2D simulation of a a flock of flying birds that are scared of mouse movement. Here is the link www.virtual-flying-birds.tk.

Sunday, December 5, 2010

Translate BIG webpages using Google Translate JS API

Today I have released yet another open source project : zgtranslate . It is a Javascript library that could be used to translate large webpages using Google Translate JS API.
Google provides a widget that can be placed in the html code of the webpage, but there are some nasty things about it:
  1. it requires flash (and I have flash removed)
  2. it translates just the current page, but not the next linked page (althow it should as it says in its help)
So I decided to make my own translator. Because Google Translate JS API can only process small texts we need to split the (large) webpage into smaller pieces that can be send to hungry Google for processing. I have implemented this split in my library.
Usage is very simple: just include the zGTranslate.js script in your webpage, and set startTranslate(id,language code) to be called when something is clicked (first example) or auto(second example) when the page was loaded.

You can download the examples and the library and see it in action.

Note: as stated in issue 1, the library does not yet works with IE6. bug fixed now