# 2012-03-24 Type your paths directly

• from http://apple.blogoverflow.com/2012/03/open-and-save-like-a-pro-secrets-of-opensave-dialogs/ :
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

• iphoto.app 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: http://accretiondisc.com/blog/2011/10/26/leaving-iphoto/
• 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 https://github.com/BMorearty/exportiphoto and you just have to type
python exportiphoto.py 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 http://en.wikipedia.org/wiki/Xargs )

• at the end, the great relief is to remove all this iphoto cr*p:
cd ~/Pictures/
rm -rf iPhoto*
cd ~/Library/Caches
rm -rf com.apple.iPhoto
• I'll be glad to help anybody with similar problem

# 2012-03-21 installing Dovecot on MacOsX using HomeBrew

• master howto: https://trac.macports.org/wiki/howto/SetupDovecot
• 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
passdb {
driver = pam
}
protocols = imap
service auth {
user = root
}
inet_listener imap {
port = 10143
}
inet_listener imaps {
port = 10943
}
}
userdb {
driver = passwd
}
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       pam_permit.so
account    required       pam_permit.so
session    required       pam_uwtmp.so

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

wget http://napoleon.acc.umu.se/debian-cd/6.0.4/i386/iso-cd/debian-6.0.4-i386-CD-1.iso # or http://debian.ens-cachan.fr/ftp/debian-cd/6.0.4/i386/iso-cd/debian-6.0.4-i386-xfce+lxde-CD-1.iso
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 http://hints.macworld.com/article.php?story=20070622210507844 ; 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:
<string>ssh</string>
<string>sftp-ssh</string>
• 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 -ir bonjour /System/Library/LaunchDaemons/ gives:
/System/Library/LaunchDaemons/com.apple.AppleFileServer.plist:                  <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.bld.bulletd.plist:                      <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.eppc.plist:                        <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.FileSyncAgent.sshd.plist:                       <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.echosvc.plist:                    <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.echosvc.plist:                    <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.lsarpc.plist:                     <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.lsarpc.plist:                     <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.mdssvc.plist:                     <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.netlogon.plist:                   <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.srvsvc.plist:                     <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.srvsvc.plist:                     <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.wkssvc.plist:                     <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.msrpc.wkssvc.plist:                     <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.odproxyd.plist:                 <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.screensharing.plist:                    <key>Bonjour</key>
/System/Library/LaunchDaemons/com.apple.smbd.plist:                     <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.

# 2012-03-10 view pdf online on firefox in macosx

• I was dropping firefox for ohter browsers as it lacked ability to display PDFs online
• after a loing wait, I found out pdf.js :
 pdf.js is an HTML5 technology experiment that explores building a faithful and efficient Portable Document Format (PDF) renderer without native code assistance.

pdf.js is community-driven and supported by Mozilla Labs. Our goal is to create a general-purpose, web standards-based platform for parsing and rendering PDFs, and eventually release a PDF reader extension powered by pdf.js. Integration with Firefox is a possibility if the experiment proves successful.
• check out: https://github.com/mozilla/pdf.js/

 copy and paste from http://hints.macworld.com/article.php?story=20091208050655947

Starting in Leopard when you open a file downloaded from the web, OS X asks if you really mean it. While it is intended to stop maliciousness, it is only a source of aggravation for me. While there are some hints here on working around it, it turns out that you can disable it completely using a Terminal command:

defaults write com.apple.LaunchServices LSQuarantine -bool NO

After that, reboot.

To know the state of your system, use

defaults read com.apple.LaunchServices LSQuarantine

, to go back to default, use

defaults write com.apple.LaunchServices LSQuarantine -bool YES