Posts about sciblog (old posts, page 9)

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:

  • by something like:

    source=./figures/aperture_aperture.mp4 % same path as in addresource!
    &loop=true % loop video
  • an interesting perspective is to use 3D objects generated by asymptote:

    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
    3Dcoo=-21.371112823486328 -19.702425003051758 -395.4008483886719,
    3Dc2c=4 2 3
  • 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:

    source=#3 % same path as in addresource!
    &loop=true % loop video
  • and then use something like:

  • note that (from ) :

    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


2012-04-05 managing defaults on MacOsX

  • when managing multiple machines, it is sometimes a pain to reset all default parameters. Still you want the same behaviour everywhere...

  • this repository display a large number of useful comands for your mac :

    # Always show scrollbars
    defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
    # Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
    defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
    # Enable subpixel font rendering on non-Apple LCDs
    defaults write NSGlobalDomain AppleFontSmoothing -int 2
    # Enable the 2D Dock
    defaults write no-glass -bool true
    # Automatically hide and show the Dock
    defaults write autohide -bool true
    # Make Dock icons of hidden applications translucent
    defaults write showhidden -bool true
    # Enable iTunes track notifications in the Dock
    defaults write itunes-notifications -bool true
    # Show all filename extensions in Finder
    defaults write NSGlobalDomain AppleShowAllExtensions -bool true
    # Show status bar in Finder
    defaults write ShowStatusBar -bool true
    # Expand save panel by default
    defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
    # Expand print panel by default
    defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
    # Disable the “Are you sure you want to open this application?” dialog
    defaults write LSQuarantine -bool false
    # Disable shadow in screenshots
    defaults write disable-shadow -bool true
    # Display full POSIX path as Finder window title
    defaults write _FXShowPosixPathInTitle -bool true
    # Increase window resize speed for Cocoa applications
    defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
    # Avoid creating .DS_Store files on network volumes
    defaults write DSDontWriteNetworkStores -bool true
    # Disable send and reply animations in
    defaults write DisableReplyAnimations -bool true
    defaults write DisableSendAnimations -bool true
    # Copy email addresses as `` instead of `Foo Bar <>` in
    defaults write AddressesIncludeNameOnPasteboard -bool false
    # Disable Resume system-wide
    defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
  • there is much more on

    git clone && cd dotfiles && ./
  • {2} TODO: make default changes for a french keyboard


2012-03-25 going back to simplicity: duckduckgo


2012-03-24 Type your paths directly

  • from :

    Let’s move on to a more advanced feature: the Go to Folder dialog. Like in Finder, you can access a prompt for typing a path by pressing ⇧+⌘+G. If you love the keyboard, you’ll love this dialog; frequently, the fastest way to get to where you want to go is by typing its path. This is especially true because the Go to Folder dialog features tab autocompletion: type the beginning of the name of a file or folder and hit tab to fill in the rest of the name automatically. My favorite part about the Go to Folder dialog is that it appears automatically whenever you begin typing a path (/ or ~). When saving, the desired filename can even be included in the path.


2012-03-22 how to leave iphoto

  • is certainly a nice tool, but it is also

    1. slow, unresponsive and locks you in some ugly closed-source format.
    2. also, try to look in forums when you want to share pictures on different {computers / OSs / iphoto versions / places / users} = nightmare!
    3. on top of that, the *cloud stuff is intellectually just very corrupted...
    4. what decided me to drop it entirely was a sudden corruption of the library. It took 2 days to recover my files and re-rotate correctly all pictures...
    5. last nail in the coffin was the fact that libraries are not backward compatible : you have to upgrade to the new product.
  • so time to take back possession of your pictures!

  • I found some supporting arguments here:

  • solution: put the files in folders according to a date organization of the type 2011/P0747444.jpg, other tools for tagging, etc... follow naturally (and you share as you share folders on dropbox or whatever)

  • first, let's set the default application for upcoming pictures from cameras:

    1. With your camera connected, open Image Capture
    2. You will see your camera under devices. Click the icon.
    3. Down at the bottom, you will see “Connecting this iPhone opens…” with a pull-down menu under it.
    4. select "autoimport" (I choose "delete after importation")
    5. another solution is to use a feature from dropbox...
  • then, let's export the data from iPhoto: File.../Export.... I kept the original file names but with the modifications (mainly rotations that were applied to my old camera without a gravity sensor). you should end up with lots of files in one directory. but it ... does not work as iphoto raises a completly unmeaningful error ('could not create file').

  • so, let's explore the library:

    1. it is package, and we can right-click in the finder to 'show package content'
    2. click the Masters folder to open it, and you'll see folders organized by year; inside are more folders organized by date and album, and inside them are photos in JPG format and video clips.
  • then I found and you just have to type

    python Pictures/iPhoto\ Library Pictures/Photos

    to achieve the export

    • I used the following commands to post-process all

      counting if everything was moved (there was some corruption in the library file with MOVies)
      find ~/Pictures/iPhoto\ Library/Masters/2012 -iname *MOV |wc -l
      find ~/Pictures/iPhoto\ Library/Masters -iname *MOV |wc -l
      find ~/Pictures/Photos -iname *MOV |wc -l
      # brute force to compare the content of the trees (brute force for the computer, you can get a coffee)
      mkdir ~/Pictures/Photos/2011
      chmod -R u+rwX ~/Pictures/Photos/2011
      find ~/Pictures/iPhoto\ Library/Masters/2011 -iname *MOV -exec cp {} ~/Pictures/Photos/2011/ \;
      mkdir ~/Pictures/Photos/2012
      find ~/Pictures/iPhoto\ Library/Masters/2012 -iname *MOV -exec cp {} ~/Pictures/Photos/2012/ \;

      (for the last exampls, see )

  • at the end, the great relief is to remove all this iphoto cr*p:

    cd ~/Pictures/
    rm -rf iPhoto*
    cd ~/Library/Caches
    rm -rf
  • I'll be glad to help anybody with similar problem


2012-03-21 installing Dovecot on MacOsX using HomeBrew

  • master howto:

  • Install

    brew install dovecot
    sudo vim /Library/LaunchDaemons/homebrew.mxcl.dovecot.plist
  • Configure

    sudo cp /usr/local/etc/dovecot/dovecot-example.conf  /usr/local/etc/dovecot/dovecot.conf
    sudo vim /usr/local/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):

    disable_plaintext_auth = no
    mail_location = maildir:~/Maildir
    ssl = no
    default_login_user = lup
    passdb {
      args = login
      driver = pam
    protocols = imap
    service auth {
      user = root
    service imap-login {
      inet_listener imap {
        address =
        port = 10143
      inet_listener imaps {
        address =
        port = 10943
    userdb {
      driver = passwd
  • Reload

    sudo launchctl unload homebrew.mxcl.dovecot.plist
    sudo launchctl load homebrew.mxcl.dovecot.plist
  • It does not work on the first try... so read documentation

    less /usr/local/share/doc/dovecot/documentation.txt
    less /usr/local/share/doc/dovecot/auth-protocol.txt
    less /usr/local/share/doc/dovecot/wiki/PasswordDatabase.PAM.txt
  • Authentification

    ls -l /etc/pam.d/
    sudo vim /etc/pam.d/dovecot

    with /etc/pam.d/dovecot being

    auth       required
    account    required
    password   required
    session    required


2012-03-16 Creating a bootable Debian USB flash drive on MacOsX

  • largely adapted from

  • download the iso

    wget # or
    hdiutil convert -format UDRW -o target.img debian-6.0.4-i386-CD-1.iso
    mv target.img.dmg target.img
  • identify where is your USB stick

    diskutil list
  • unmount the USB stick

    diskutil unmountDisk /dev/disk2
  • write on the stick

    mv target.img.dmg target.img
    sudo dd if=target.img of=/dev/rdisk2 bs=1m
  • eject the USB stick

    diskutil eject /dev/disk2


2012-03-13 Moving Time Machine to a New Hard Drive

  • There exist some solution to move a time machine data folder to a new drive by making a clone of the drive. My problem is that I already have data on the new drive and that this data can difficultly be moved.

  • It try (after switching off Time machine of course) with rsync while keeping hard links:

    sudo rsync -av -H  /Volumes/tera_enigma/Backups.backupdb /Volumes/2T_un/
  • This takes a while as rsync has to manage a lot of them (may take also a lot of memory, so be patient)


2012-03-12 Doing a red-lined article file from two versions of a paper in LaTeX

  • The editor of our submitted paper asked for a red-lined article file. Using latexdiff makes this task very easy: Simply grab the 2 versions of your manuscript and issue

    latexdiff manuscript_v1.tex manuscript_v2.tex   > diff.tex
    latexmk -pdf diff.tex

    . The latexmk program allows to get all necessary passes to get a clean output file.

  • One issue is that one version imported a few other source files using the \input command, so we used the following parameter:

    latexdiff --flatten manuscript_v1.tex manuscript_v2.tex   > diff.tex
    latexmk -pdf diff.tex
  • it is recommended that instead of using bibtex, you copy and paste the content of the .bbl file.

  • Moral: one advantage of LaTeX is that your data, your dear prose, is in text (not binary) format and has an open syntax. This process allows the creation of the red-lined article file in one shot with no fiddling and lost time of copy and pasting. So whatever soft you use to put your ideas in readable digital format, just use something simple, structured and open.


2012-03-11 Stop Bonjour from broadcasting ssh and sftp

largely a copy-and-paste from ; Jun 25, '07 07:30:00AM • Contributed by: delight1
  • After doing a backup, edit the following file:

    sudo vim /System/Library/LaunchDaemons/ssh.plist
  • In the editor, the goal is to delete these two lines:

  • They should be found around lines 22 and 23. In vim, this is easily done by typing \ssh, then n until you are on the right line. Then type d2d to delete these 2 line. Finally issue wq! to save and quit.

  • Save the file and quit the editor. Then go to System Preferences » Sharing » Services, unlock it, disable Remote Login, and final re-enable Remote Login. You can check if things worked by using Bonjour Browser or some such similar app to be sure ssh/sftp no longer show up.

  • A simple grep-irbonjour/System/Library/LaunchDaemons/ gives:

    /System/Library/LaunchDaemons/                  <key>Bonjour</key>
    /System/Library/LaunchDaemons/                      <key>Bonjour</key>
    /System/Library/LaunchDaemons/                        <key>Bonjour</key>
    /System/Library/LaunchDaemons/                       <key>Bonjour</key>
    /System/Library/LaunchDaemons/                    <key>Bonjour</key>
    /System/Library/LaunchDaemons/                    <key>Bonjour</key>
    /System/Library/LaunchDaemons/                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/                   <key>Bonjour</key>
    /System/Library/LaunchDaemons/                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/                 <key>Bonjour</key>
    /System/Library/LaunchDaemons/                    <key>Bonjour</key>
    /System/Library/LaunchDaemons/                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/ftp.plist:                        <key>Bonjour</key>
    /System/Library/LaunchDaemons/ssh.plist:                        <key>Bonjour</key>
    Binary file /System/Library/LaunchDaemons/telnet.plist matches

    so, you may want to change these too.