Posts about sciblog (old posts, page 10)

2012-09-09 installing linux on imac hardware

  • on a 2007 imac that will slow to a crawl since mountain lion, I have installed linux mint (why not debian?)
  • works as expected and the speed to check e-mails / browse the web is back
  • some bugs like this silly swapping of keys: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/214786
  • fix : echo0|sudotee/sys/module/hid_apple/parameters/iso_layout

Comments

2012-09-04 connecting a linux client to a QNAP's LDAP server

Comments

2012-08-27 installing Dovecot on QNAP

  • master howto: http://forum.qnap.com/viewtopic.php?f=143&t=33376&start=30

  • Configure

    sh xdove.sh stop
    cd /share/HDA_DATA/.qpkg/XDove
    vim dovecot/etc/dovecot/dovecot.conf
    
  • Mine reads (it's just meant to access imap files from the local mail server and not to serve outside the localhost):

    auth_user = admin
    login_user = dovecot
    login_chroot = no
    protocols = imaps
    listen = localhost:993
    log_path = /var/log/dovecot/dovecot.log
    info_log_path = /var/log/dovecot/dovecot-info.log
    #ssl_disable = yes
    #ssl = no
    #disable_plaintext_auth = no
    ssl = yes
    ssl_cert_file = /etc/stunnel/stunnel.pem
    ssl_key_file = /etc/stunnel/stunnel.pem
    mail_location = maildir:/var/MailRoot/domains/%d/%n/Maildir
    first_valid_uid = 10
    
    dotlock_use_excl=yes
    mailbox_idle_check_interval = 30
    maildir_stat_dirs = no
    maildir_copy_with_hardlinks = no
    
    auth_executable = /usr/libexec/dovecot/dovecot-auth
    auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@
    auth_verbose = yes
    auth_debug = yes
    auth_debug_passwords = yes
    mail_debug = yes
    
    protocol imap {
    #       login_greeting_capability = yes
            imap_client_workarounds = tb-extra-mailbox-sep
            login_executable = /usr/libexec/dovecot/imap-login
            mail_executable = /usr/libexec/dovecot/imap
            #imap_client_workarounds = outlook-idle
    }
    
    auth default {
           mechanisms = plain
           passdb checkpassword {
           args = /usr/bin/checkpassword
           }
    
           userdb static {
           args = uid=xmail gid=xmail home=/var/MailRoot/domains/%d/%n/Maildir
           }
    }
    
  • Reload

    sh xdove.sh restart
    

Comments

2012-08-19 István Orosz

  • discovered this by looking to nemo > outis > http://en.wikipedia.org/wiki/Istv%C3%A1n_Orosz
  • should be called "blink your eyes" (great effect of memory as in the dalmatian- you do not need to blink after "seing it"): http://upload.wikimedia.org/wikipedia/en/1/15/Dureralbrecht.jpg
  • nice synthesis of the anamorphosis technique, a great poster for explaining perception: http://upload.wikimedia.org/wikipedia/en/9/98/Anamorphosis.jpg

Comments

2012-07-24 Make PDF files searchable and copyable

  • The cmap package is intended to make the PDF files generated by pdflatex "searchable and copyable" in acrobat reader and other compliant PDF viewers.
  • Just put the line \usepackage{cmap} at the beginning of your preamble, and it will pre-load the needed CMap translations for the fonts used in the document, provided that there exists the file <encoding>.cmap for the font encoding.
  • more @ http://www.ctan.org/tex-archive/macros/latex/contrib/cmap/

Comments

2012-07-10 using and re-using metadata in LaTeX

Introduire des metas / Include meta keywords

  • pour mieux référencer votre papier, introduisez des metas en ajoutant avant le \begin{document} la commande

    \hypersetup{%
      pdftitle={my title},%
      pdfsubject={short description},%
      pdfauthor={Laurent Perrinet <Laurent.Perrinet@univ-amu.fr.fr>, INT/CNRS, 31, ch. Joseph Aiguier, 13402 Marseille Cedex 20, France; http://invibe.net/LaurentPerrinet},%
      pdfkeywords={Neuronal representation, ....},%
    }
    
  • vous aurez besoin auparavant de charger le package hyperref:

    \usepackage[pdftex, pdfusetitle ,colorlinks=false, pdfborder={0 0 0}]{hyperref}%
    

variables

  • the basics is to use variables within LaTex

  • for instance, these may be useful to define a switch

    \let \mode=0
    \if 1\mode
     truc...truc...truc
    \else
    \fi
    

complete example

  • even better, we can use string variables

    \documentclass[11pt]{article}
    %-------definitions-----
    \newcommand{\Author}{Laurent Perrinet}
    \newcommand{\Address}{INT}
    \newcommand{\Website}{http://invibe.net/LaurentPerrinet}
    \newcommand{\Email}{Laurent.Perrinet@incm.cnrs-mrs.fr}
    \newcommand{\Title}{My title}
    \newcommand{\Keywords}{my first keyword, my first keyword, more keywords.}
    %--------------------------
    \usepackage{url}
    \usepackage[pdftex, pdfusetitle,colorlinks=false,pdfborder={0 0 0}]{hyperref}%
    \hypersetup{%
    pdftitle={\Title},%
    pdfauthor={\Author < \Email > \Address - \Website},%
    pdfkeywords={\Keywords},%
    }%
    \begin{document}
    \title{\Title}
    \author{\Author\thanks{\Address , e-mail: \Email , WWW: \Website }}
    \date{}
    \maketitle
    {\bf Keywords:} \Keywords %
    
    My text is here...
    
    \end{document}
    

Comments

2012-06-12 racourci pour accéder à une page INIST

  • dans un journalqui nécessite un abonnement pour accéder au contenu, il faut passer par le serveur de l'INIST.

  • pour ne pas avoir à taper ".gate1.inist.fr" pour accéder au texte d'un papier, on peut utiliser un bookmarklet avec comme adresse:

    javascript:window.location=window.location.protocol+'//'+window.location.hostname+".gate1.inist.fr"+window.location.pathname;
    
  • maintenant, sur la page incriminée, cliquer sur ce bookmark, et voilà.

  • pour en savoir plus sur les bookmarklets, suivre https://support.mozilla.org/en-US/kb/bookmarklets-perform-common-web-page-tasks .

Comments

2012-04-30 rotating a video using ffmpeg

  • turn to the right

    ffmpeg  -i  2012-04-29\ 19.31.32.mov  -vf "transpose=1" -sameq -y 2012-04-29\ 19.31.32_right.mov
    
  • turn to the left

    ffmpeg -i  2012-04-29\ 19.31.32.mov  -vf "transpose=3" -sameq 2012-04-29\ 19.31.32_left.mov
    
  • upside down

    ffmpeg -i  2012-04-29\ 19.31.32.mov  -vf "transpose=2" -sameq 2012-04-29\ 19.31.32_left.mov
    
  • made some scripts:

    $ vim ~/bin/video_rotate.sh
    $ chmod +x ~/bin/video_rotate.sh
    
    $ cat  ~/bin/video_rotate.sh
    #! /usr/bin/env bash
    ORIGINAL_IFS=$IFS
    IFS=$'\n'
    ffmpeg  -i $1 -v 0  -vf "transpose=$2"  -qscale 0 -y tmp.mov && mv tmp.mov $1
    IFS=$ORIGINAL_IFS
    
    $ video_rotate.sh 2012-04-29_19.31.32.mov 1
    

Comments

2012-04-22 Converting FLAC to AAC (or MP3 to OGG etc...)

  • the solution is http://audiotools.sourceforge.net/

  • installation on MacOsX Lion (with homebrew) :

    brew install libcdio
    brew install lame two-lame mpg123 mp3gain
    brew install libogg libvorbis     vorbis-tools  vorbisgain
    brew install faac faad2
    git clone git://github.com/laurentperrinet/python-audio-tools.git  audio-tools
    cd audio-tools
    make
    make install
    
  • using it:

    track2track  -t aiff *.flac #lossless
    track2track  -q 0 -t m4a *.ogg #lossy
    
  • and on a whole folder, placing the files in the same directory:

    find a_folder/with/lots_of_flac -name *flac -exec sh -c 'echo "Processing $0"; track2track -t aiff  "$0" -o "${0%.flac}.aiff"' {} \;
    find a_folder/with/lots_of_ogg -name *ogg -exec sh -c 'echo "Processing $0"; track2track -t m4a  "$0" -o "${0%.flac}.m4a"' {} \;
    
  • tried as a formula in homebrew: https://github.com/mxcl/homebrew but closed it.

Comments

2012-04-17 transition from movie15.sty to media9.sty

  • recently, a message popped-up :

    Package movie15 Warning: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    (movie15)                @@ Package `movie15' is obsolete and @@
    (movie15)                @@ superseded by `media9'.           @@
    (movie15)                @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
    
  • a first read to the manual (texdocmedia9), seemed to be a regression, as it could do more complicated stuff (reading youtube files from within a PDF) but not the simple stuff you really use (I will never read a youtube files from within a PDF ...). In addition, the movie15 package was removed from texlive, so you have to make the transition (this was easily fixed by downloading a copy of movie15.sty)

  • to make the change, you have to change the lines which are like:

    \includemovie[label=aperture_aperture,poster=figures/aperture_aperture.png,mouse,repeat,autoplay]{\linewidth}{.75\linewidth}{./figures/aperture_aperture.mp4}
    
  • by something like:

    \includemedia[
    width=\linewidth,height=0.75\linewidth,
    activate=pageopen,
    addresource=./figures/aperture_aperture.mp4,
    flashvars={
    source=./figures/aperture_aperture.mp4 % same path as in addresource!
    &loop=true % loop video
    }
    ]{}{VPlayer.swf}
    
  • an interesting perspective is to use 3D objects generated by asymptote:

    \includemedia[
    width=0.8\linewidth,height=0.8\linewidth,
    activate=pageopen,
    add3Djscript=asylabels.js, %upright text labels
    add3Djscript=3Dspintool.js, %let scene rotate about z-axis
    % 3Dcoo, 3Droo values found with ‘Generate Default View’ from
    % context menu
    3Dmenu,
    3Dcoo=-21.371112823486328 -19.702425003051758 -395.4008483886719,
    3Droo=472.3543474473915,
    3Dc2c=4 2 3
    ]{}{epix.prc}
    
  • one solution for a smooth transition is my case where I need to just show a movie and nothing too fancy, one can create a command in the preamble like:

    \newcommand{\includemovie}[3]{%
    \includemedia[
    width=#1,height=#2,
    activate=pageopen,
    addresource=#3,
    flashvars={
    source=#3 % same path as in addresource!
    &loop=true % loop video
    }
    ]{}{VPlayer.swf}
    }
    
  • and then use something like:

    \includemovie{\linewidth}{.75\linewidth}{./figures/aperture_aperture.mp4}
    
  • note that (from http://tex.stackexchange.com/questions/45242/animations-with-movie15-and-swf-files ) :

    Video files must be in the MP4 format. Videos in other formats must be converted to MP4 or recreated from the raw material. The H.246 codec gives high quality video at stunningly small file size. With ffmpeg, video files can be created easily.
    
    From an existing video file, such as Sample.avi:
    
    ffmpeg -i Sample.avi -vcodec libx264 Sample.mp4
    
    From a numbered sequence of bitmaps, such as frame-0.png, frame-1.png, ... :
    
    ffmpeg -i frame-%d.png -vcodec libx264 myvideo.mp4
    

Comments