Mittwoch, 22. April 2009

LaTeX Hints

As promised, here some nice LaTeX hints.

1. Fancy Chapter Titles

Check this out:
http://zoonek.free.fr/LaTeX/LaTeX_samples_chapter/0.html

2. Make your Table of Contents, Footnotes, Refs click able
\usepackage[colorlinks,pdfpagelabels,pdfstartview = FitH,bookmarksopen = true,bookmarksnumbered = true,linkcolor = black,plainpages = false,hypertexnames = false,citecolor = black] {hyperref}
Options are pretty self explanatory

3. Make boxes around your text
\usepackage{framed}
\begin{framed}
...
\end{framed}
4. Alphabetic, roman enumeration:
\usepackage{enumerate}
\begin{enumerate}[a.)]
...-> a.), b.) ...

\begin{enumerate}[i.)]
...-> i.), ii.) ...

etc.
5. Fancy header and footer
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markboth{\thesection\ #1}{}}
\renewcommand{\subsectionmark}[1]{\markright{\thesubsection\ #1}}
\lhead[ \leftmark ]{\textbf{Diploma thesis}}
\rhead[\textbf{This is my topic}]{\leftmark}
\lfoot[\thepage ]{\scriptsize \textcopyright2009, Wienert, HTW Dresden}
\cfoot[]{}
\rfoot[\scriptsize \textcopyright2009, Wienert, HTW Dresden]{\thepage}
6. Line break inside tables
\usepackage{multirow}
7. Make 1.5 times or 2.0 times (which is equal to Word's 1.5er...) line spacing
\usepackage{setspace}

\doublespacing
\onehalfspacing
8. Syntax highlighting
\usepackage{listings}
\usepackage{color}
\definecolor{darkgreen}{rgb}{0.4,0.8,0.4}
\definecolor{darkred}{rgb}{0.5,0,0}
\definecolor{rosa}{rgb}{0.6,0.1,0.6}
\lstset{
language=java, % choose the language of the code
basicstyle=\footnotesize, % the size of the fonts that are used for the code
numbers=left, % where to put the line-numbers
numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
stepnumber=1, % the step between two line-numbers. If it's 1 each line will be numbered
numbersep=5pt, % how far the line-numbers are from the code
backgroundcolor=\color{white},
showspaces=false,
showstringspaces=false,
showtabs=false,
frame=single,
tabsize=4,
captionpos=t,
breaklines=true,
breakatwhitespace=false,
%escapeinside={\%*}{*\%}{//}, % if you want to add a comment within your code
keywordstyle=\color{darkred}\bfseries,
commentstyle=\color{darkgreen},
stringstyle=\color{rosa},
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]",
morestring=[d]’,
frame=tb
}
\lstset{index={}}
...
\begin{lstlisting}
int i;
i=Integer.parseInt(S);
\end{lstlisting}
check out: http://en.wikibooks.org/wiki/LaTeX/Packages/Listings

9. Better placed limits at math:Sum and math:Integral:
\sum\limits_{i=0}^\infty
For the lazy: \newcommand{\intt}{\int\limits}

10. Letters and applications:

Various letters, prep'd for c&p:
http://www2.informatik.hu-berlin.de/~jaenisch/Latex/index.htm

German-style application: http://www.datenteiler.de/bewerbung-und-lebenslauf-mit-latex/

Download youtube videos (and whole chanels) from the terminal

Because I need some video tutorials, which I prefer to watch off-line (in the train for instance), I prog'd a Shell-Script (for linux terminal) to do the work for me.

1. y2flv.sh

#!/bin/bash
echo "::Try to get $1"
wget -q -O tmp.tmp "$1"
wget -O "`cat tmp.tmp | grep video_id= | grep fullscreen | egrep "title=(.*)" -o | egrep "[^=]*$" -o | egrep "^[^\']*" -o`.flv" http://www.youtube.com/get_video`cat tmp.tmp | grep video_id= | grep watch_fullscreen | egrep "\?(.*)" -o`
rm tmp.tmp
Usage (after chmod u+x y2flv.sh):
$ y2flv.sh http://www.youtube.com/watch?....

2. Complete Channel Download:

#!/bin/bash
wget -nv -O tmp2.tmp "$1"
for i in `cat tmp2.tmp | grep watch? | egrep "href=\"[^\"]+\"" -o | grep watch? | grep channel | egrep "[^(href=\"\/)].+[^\"]" -o | sort | uniq`
do
echo $i
./y2flv.sh "http://www.youtube.com/$i"
done
rm tmp2.tm

have fun with these ;)

PS: Converting a flv to mp3 (after apt-get install ffmpeg)
ffmpeg -i in.flv -acodec copy out.mp3

Donnerstag, 26. März 2009

End of vacation - begin of the 4th semester

Three weeks of relaxing... Over!

During this time, I read some news and found some interesting website which I like to share with you.

Descent 1 & 2 under Linux
For those of you, who played the computer in the middle of the 1990th's, you may know the games Descent and Descent 2. In these games, you fly completly 3-dimensional in outer space mines and shoot at some nasty robots :) I like this game, because the steering is very good (after changing to WASD + Mouse...) and it is quite challenging.
So, some guys made a port for Linux, which runs great!
http://www.dxx-rebirth.com/
Installation guide (german): http://wiki.ubuntuusers.de/Spiele/Descent

Against Intellectual Monopoly
One quite revolutionary book, I have found recently. In this book, the authors state that a removal of Copyright and patent law would result in a new boom. In accord with the title, you can download this book for free, of course. :)
http://www.dklevine.com/general/intellectual/againstfinal.htm

Running several Microsoft Windows operation systems on very poor computers

There are two guys out there competing, who can make a MSWindows (XP,Vista) run on the weakest computer.... like a Pentium 60 for Windows XP :D awesome (but useless of course^^)
http://www.winhistory.de/more/386/xpmini.htm

Online comics
In our English classes, sometime read some comics from "Dilbert", a webcomic about the allday life in a company (in a funny way).
http://www.dilbert.com/most_popular/

Btw: another comic, I read regulary, is the "Order of the Stick"... A very funny fantasy-based comic, which teases the "(Advanced) Dungeon & Dragons" role-playing game system; If you like RPGs (whether pen&paper or pc games [Neverwinter Nights, Baldur's Gate...]) then you will love this ;)
http://www.giantitp.com/comics/ootslatest.html

MS-Word is Not a document exchange format
Without words...
http://www.goldmark.org/netrants/no-word/attach.html

LaTeX
During the vacation, I "played" a lot with this awesome typsetting system... With my next blog I will spread out some of the tweaks, hints I learned the last weeks ;)

Montag, 23. Februar 2009

Vacation!

Puhh... Finally, the exam period is over, and I have now some time for different things I delayed :) Such as:

Installing Ubuntu on my desktop PC

After some weeks working with Ubuntu on my Asus eee Netbook PC, finally, I now could not wait to install this fine operation system on my desktop computer as well.

Again, my MP3-Player did his job as an installation medium (I really like that!). First, trying the kubuntu/KDE, but after some hours changing back to the GNOME, which I prefer due to its tidiness and clearity.
Unfortunatly, I have still some problems with my graphics device: I cannot activate Compiz and watch movies at the same time... then, flickering all the time. After some research on that problem, I found out that I am not alone with this issue and that this is a specific problem with ATI grafic devices and Linux systems... I sense this as the biggest flaw right now.
Altogether, I do not regret my change: Ok, I cannot play 3D-Games anymore, but... who cares? Now I have ultimate access to any programming language, a bunch of great programms like "Kile/LaTeX-Editor"....which just makes fun!

Yesterday, I started Windows again,... yeah with a new motherboard and a new hard drive.... I tooks *only* 30 minutes to install the drivers (I needed the CD, of course)... ahh and 5 rebooting :D... Ubuntu? No reboot, no required CD.
Bye Windows...

Plans for the next week

Now, outfitted with this new equipment, I plan to learn the scripting language Python, and maybe Django, the web development MVC framework based on this.

But first, I have to fight a little with MS Access and Word due to my work *lets get ready to ruuuuuummmmble*! *sigh*

CeBIT


First time in my life, I plan to visit the CeBit, the biggest IT fair in Germany which lasts from March 3rd to 8th.

Sonntag, 1. Februar 2009

Chinese - ... the language, not the food!

Due some reasons I came in contact with the Chinese language recently.
As is proper for a ongoing computer scientist, I approach this topic in a logical way:

First, some facts:
  • 5,000 characters (symbols)
  • 1.2 billion native speakers
  • different dialects (Mandarin, Cantonese..)
  • no grammar (reflections)
  • 3 tenses (past, now, future) <--- worth a look! :)
  • 1 Symbol = complete word or part of a sentence
  • same phonetic, different meaning: Xing can refer to "OK" and "Sex" both
My first thought: Wow, 5k characters... how to type them??
So, a Chinese keyboard is a "normal" English one. They use this to type the phonetic spelling (latin alphabet) of the word they want to type and the software suggests several words that match with that pronunciation.
Ok, so some pratical thing:
How to install Chinese font input system on Ubuntu/linux (8.10)

  • $ sudo apt-get install scim scim-chinese scim-config-socket ttf-arphic-bsmi00lp ttf-arphic-gbsn00lp ttf-arphic-gkai00mp ttf-arphic-bkai00mp scim-frontend-socket scim-gtk2-immodule scim-server-socket scim-tables-zh xfonts-intl-chinese xfonts-intl-chinese-big
  • After finished installation, create/open ".xsession" in your Home-Directory ( $ nano .xsession)
    there:
scim -d
export XMODIFIERS=@im=scim
export GTK_IM_MODULE=scim
gnome-session
  • save/exit
  • make this file executable:
    chmod +x .xsession
  • Restart X-Server (Strg+Alt+Backspace)
Now you can enter the Chinese input system via strg+space at a text cursor position. Maybe you would like to change the input dialect:
after strg+space click the most left button in scim, choose chinese (simplified) and the last one.
Now you can use this function in most of the text processing applications like gedit und firefox (tested).

晚安! (Wan an = GN8)

Samstag, 24. Januar 2009

Some interesing articles about programming everyday life


Real programmers don't use Pascal


http://guest.engelschall.com/~sb/realmen/

contains several amusing phrases like:
Today's college graduates are soft-protected from the realities of programming by source level debuggers, text editors that count parentheses and user-friendly operating systems.

Bad response time doesn't bother the Real Programmer: It gives him a chance to catch a little sleep between compiles.

...and many more... :) worth a look (for ongoing Computer Scientists..)


How to write unmaintainable Code


http://mindprod.com/jgloss/unmain.html

Even funnier... Somehow useful, because you get to know, what you might actually not should do :)

In naming functions and variables, make heavy use of abstract words like it, everything, data, handle, stuff, do, routine, perform and the digits e.g. routineX48, PerformDataFunction, DoIt, HandleStuff and do_args_method.

Hungarian Notation is the tactical nuclear weapon of source code obfuscation techniques;

Use constant names like LancelotsFavouriteColour instead of blue

You see why you should never use concrete examples? They are too clear. [...] After all, no academic would be caught dead giving an example. People only respect that which is too abstract to grasp easily.

Make sure that every method does a little bit more (or less) than its name suggests. As a simple example, a method named isValid(x) should as a side effect convert x to binary and store the result in a database.

Insist on carrying outright orthogonal information in your Hungarian warts. Consider this real world example: "a_crszkvc30LastNameCol". It took a team of maintenance engineers nearly 3 days to figure out that this whopper variable name described a const, reference, function argument that was holding information from a database column of type Varchar[30] named "LastName" which was part of the table’s primary key

The Netscape colours are all carefully named. For example papayawhip is 0xffefd5. Just to keep them on their toes, define a papayawhip colour constant as 0xff00ff, a garish magenta. Have fun making up obscure colour names like algae = 0x556b2f instead of darkolivegreen. Very few people know what colour puce and teal are, but would never admit it. Exploit that.
Enough of computer related brain teaser distraction, and back to work! That thesis doesn't write it on it's own, only one week remaining till examinations will start...

Samstag, 17. Januar 2009

Ubuntu Linux: First approach on my Asus eee-pc netbook

Currently, I have to work on several projects that are required to take part at the exams in february. Projects... in the particular of studying Computer Sciences this is, of course: programming. Quite a lot.
Last semester I wrote all my projects under Windows... *shame on me*

But two days ago, I thought it's time to move forward... so I installed Ubuntu on my EEE-PC. It was somewhat tricky since the eee-pc has no DVD drive, so one has to improvise and take for exampe an USB memory stick for the installation.
But I don't have anyone, so I had thought my MP3-Player with cable connection would do the trick, too. And it does!
By reason that I want to keep my Windows XP installation (because I paid for it..) on the built-in solid state drive, I decided to install Ubuntu on a 8 gb SD-card :).
As you can imagine... installing from a USB memory to a SD card will take a while; so a few hours later, a fresh new Ubuntu is ready to use!

Of course, at first, several devices were not working (like WLAN). But there is a great community out there which created very good tutorials and scripts to cope with that fact.
So without any problems until now, I installed every programm that I need (or for fun of course ;D), and: That is very simple and efficient... I never had to make a restart of my system (like Windows), or had to consider, where I have to install it, if I need other programms to run it, etcpp.
If you don't know: usually, in Ubuntu you install programms through a packet management software. There you can choose between thousands of (free!!) applications to download and install. This process is automatically done by this software.
I can do this also from a terminal:
for example, I needed the clisp - environment for my studies, I opened a terminal and typed:

$ sudo apt-get install clisp
--- then I have to confirm and the installation will proceed, after that I can immediately start to use the programm, so:
$ clisp

Awesome!

What's about graphics?
One really great tool for work (and fun^^) is the so called compiz window manager. This programm takes care of the management of your virtual desktops which you cycle through at any time with ALT+left/right. And while changing you have really nice 3D effects, hardly to describe, check out the youtube video ;)


My conclusion: Wow! Absolutly amazing, working makes now a lot of fun and through the virtual desktops and fast access to all programms I need, it's now a very effective and efficient work (btw: difference of effective and efficient)