Found on a bathroom door at “Høyteknologisenteret i Bergen”…


word on the street has it Saiboten may in fact be geeky enough to have accomplished this feat
No related posts.
46 items (46 unread) in 5 feeds
Found on a bathroom door at “Høyteknologisenteret i Bergen”…


word on the street has it Saiboten may in fact be geeky enough to have accomplished this feat
No related posts.
When ever you use the terminal in Linux or OS X, and forget to add sudo in front of a command that needs the privileges, you can simply type sudo !! to run the same command with sudo. awesome. “!!” Will repeat the last issued command, and can probably be used for other useful things, too.
Thanks, Peder 2.
No related posts.
I am writing my master thesis using LaTeX, a typesetting system most commonly used for scientific documents. Since my thesis is in computer science, I have the need to display a fair amount of code. After searching around the net and with some trial and error, I have come up with some settings that does this in a nice way.
It is based on the listings package, we define a lstset that handles the code. This in combination with a nice caption makes for a nice presentation of source code.
Here is the final result:

LaTeX Source Code Screenshot
“Read more” for the rest of the article
The packages needed are:
We now define the caption as:
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
This makes a gray box for the caption, with white text.
Now define the lstset with the following:
\lstset{
language=Java,
keywordstyle=\bfseries\ttfamily\color[rgb]{0,0,1},
identifierstyle=\ttfamily,
commentstyle=\color[rgb]{0.133,0.545,0.133},
stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},
showstringspaces=false,
basicstyle=\small,
numberstyle=\footnotesize,
numbers=left,
stepnumber=1,
numbersep=10pt,
tabsize=2,
breaklines=true,
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
breakatwhitespace=false,
aboveskip={1.5\baselineskip},
columns=fixed,
upquote=true,
extendedchars=true,
frame=bottomline,
inputencoding=utf8
}
The language must obviously be changed to the language you are using, to provide the correct syntax coloring.
the numbers parameter chooses whether to show line numbers or not, the prebreak parameter adds an arrow to indicate that the line is broken. The upquote parameter ensures that no fancu “‘s are used, so that you can copy the code and still be able to run it. The other parameters should be self-explanatory, and can be modified as you see fit.
To use this in your document, you can insert code directly with:
\begin{lstlisting}[label=some-samplecode, caption=Example for code straight from the .tex file]
<insert code here>
\end{lstlisting}
or you can insert code from an external file using:
\lstinputlisting[label=samplecode,caption=Example for code from a file]{sourceCode/K53.java}
all of these can now be referenced from other places in the document with the \ref{labelname} command, and will show up in your overview of listings.
Related posts:
In the new Thunderbird 3, Mozilla included tabbed browsing. Since you usually don’t have tabs open all the time, it would be nice to be able to hide the tab-bar when no tabs are open. There is a hidden option to accomplish this. Thanks to Truben for pointing this out!
Read his article at http://truben.no/journal/auto-hide-tab-bar-in-mozilla-thunderbird-3/
No related posts.