Tuesday, November 3, 2015

LD cannot find library because of version numbering

It is Debian convention to separate shared libraries into their runtime components (libmagic1: /usr/lib/libmagic.so.1 → libmagic.so.1.0.0) and their development components (libmagic-dev: /usr/lib/libmagic.so → …).
Because the library's soname is libmagic.so.1, that's the string that gets embedded into the executable so that's the file that is loaded when the executable is run.
However, because the library is specified as -lmagic to the linker, it looks for libmagic.so, which is why it is needed for development.
See Diego E. Pettenò: Linkers and names for details on how this all works on Linux.

In short, you should apt-get install libmagic-dev.
This will not only give you libmagic.so but also other files necessary for compiling like /usr/include/magic.h.

src: http://stackoverflow.com/questions/335928/ld-cannot-find-an-existing-library

Thursday, September 10, 2015

How to install Skype on Kubuntu 14.04

open muon
if you are in muon discover go to "sources">"configure sources"
check all on the Kubuntu software tab
then click the "other software"tab and make sure "canonical partners" is checked.
close muon
and back at the konsole:
sudo apt-get update
sudo apt-get install skype
 
Src: http://community.skype.com/t5/Linux-archive/How-to-install-Skype-for-Kubuntu-14-04/td-p/3602591 

Wednesday, August 19, 2015

Imagemagick in bash, resize images

The following command will resize an image to a height of 100:
convert example.png -resize x100 example.png
 Src: http://www.howtogeek.com/109369/how-to-quickly-resize-convert-modify-images-from-the-linux-terminal/

Tuesday, August 4, 2015

Latex Temporarily disable superscript in citation

The following example changes \setcitestyle locally and puts it in macro \citen. \setcitestyle of package natbib (2010/09/13 8.31b) contains a space right at the beginning of the macro definition by an uncommented end of line, the trick with \romannumeral removes this space.
\documentclass{article}
\usepackage[square]{natbib}
\setcitestyle{super}

\newcommand*{\citen}[1]{%
  \begingroup
    \romannumeral-`\x % remove space at the beginning of \setcitestyle
    \setcitestyle{numbers}%
    \cite{#1}%
  \endgroup   
}

\begin{document}
Package \textsf{accsupp}\cite{oberdiek:accsupp}.
This figure is reproduce from reference~\citen{oberdiek:zref}.
\bibliographystyle{plainnat}
\raggedright
\bibliography{oberdiek-bundle}
\end{document}
Result
Inside moving arguments (e.g., \caption) macro \citen can be protected using \protect or by using \DeclareRobustCommand for the definition:
\newcommand*{\citen}{}% generate error, if `\citen` is already in use
\DeclareRobustCommand*{\citen}[1]{%
  \begingroup
    \romannumeral-`\x % remove space at the beginning of \setcitestyle
    \setcitestyle{numbers}%
    \cite{#1}%
  \endgroup
}
 
Source: http://tex.stackexchange.com/questions/94178/temporarily-disable-superscript-in-citation

Friday, July 24, 2015

bash split pdf

$ sudo apt-get update
$ sudo apt-get install pdftk
EDIT: since pdftk became deprecated, do:
sudo snap install pdftk

Then, to make a new pdf with just pages 1, 2, 4, and 5 from the old pdf, do this:

$ pdftk myoldfile.pdf cat 1 2 4 5 output mynewfile.pdf
Note that cat and output are special pdftk keywords. cat specifies the operation to perform on the input file. output signals that what follows is the name of the output pdf file.
You can specify page ranges like this:
$ pdftk myoldfile.pdf cat 1-2 4-5 output mynewfile.pdf 
 
http://linuxcommando.blogspot.ca/2013/02/splitting-up-is-easy-for-pdf-file.html 

Find LaTeX multiply-defined labels

perl -nE 'say $1 if /(\\label[^}]*})/' *.tex | sort | uniq -c | sort -n
 
 http://www.mawode.com/blog/blog/2012/03/21/finding-duplicate-latex-labels/

Thursday, July 9, 2015

MATLAB uniform ticks (uniformticks) and printing

The following script can make the axes nicer. Example:

%% render uniform ticks digits on Y axis
function uniformticks_y(deci) ; % input number of decimals as string
command = ['%0.' mat2str(deci) 'f|'] ;
ticks = get(gca, 'Ytick') ;
set(gca, 'YTickLabel', sprintf(command, ticks));

However, changing the graph manually in the GUI can upset the nice axes settings. Simply rerun the script from the console without closing the graphs.