mercredi 9 décembre 2009

Playing with Nikon D90 & Nikkor 70-210mm 4-5.6 AF-D


Recently, as I was looking on Ebay for a cheap lens to shoot some sports and portraits, 70-200 or such, with decent results, I found a Nikkor 70-210mm 4-5.6 AF-D.
Reviews about this lens, and eventually its use with modern amateur reflexes are rare (1999 huh ...), so I guess these few words could help some of us.

For 50€, it was more or less a $100 better deal than the usual Ebay price. I'm not a photo-geek, so I'm just looking for a reasonable price/quality ratio, not the sharpest, stabilized, fixed aperture, expensive and all plastic lens.

This AF-D lens was made before 1999 and still works like a charm, thanks to its solid-but-heavy all-metal body. Good. Despite its humble specifications (4-5.6, ...), it's said to have a very likeable fast focus and decent distortion, color rendition and sharpness across the field.
As all Nikkor AF(-D), this lens is compatible with the Nikon D90 body : autofocus, aperture (ring has to be locked to the smallest aperture - highest value - 32 here), metering, ...


My conclusion : it works just fine on D90, it's indeed really fast at focusing and provides very pleasant results even under the poor conditions I shot the picture above.
Get one if you find one for $100!

Some pictures I took right out-of-the-box :
http://www.flickr.com/photos/jeromenerf/sets/72157622966544084/detail/

Always a good idea to see others work on Flickr :
http://www.flickr.com/search/?w=all&q=nikkor+70-210+AF-D&m=text

Ken "chucknorris" Rockwell enthusiastic review :
http://www.kenrockwell.com/nikon/7021056.htm

How-to: restoring Grub2 on Debian


Debian recently chose to switch from grub1 (now grub-legacy) to grub2 (now grub-pc).
Those who upgraded their Debian Unstable/Sid recently might have suffered from annoying "Error 15" on boot, mostly due to grub2 being unable to read its files.

Here's the classic mount-chroot-restore method to fix that kind of problems.

1. fetch pre-requisites
You need a bootable Debian Install medium (CD, USB stick, network boot, etc), the smallest (business card) will do.

2. boot your media

3. choose "rescue mode", select lang and keyboard and switch to vt2 (Ctrl-Alt-F2)

4. mount your disk(s) partitions


$ cat /proc/partitions
...
$ modprobe ext2 # load whatever you need, ext2, xfs, etc
$ mount /dev/hda2 /mnt # your root partition first
$ mount /dev/hda1 /mnt/boot # your boot partition if one
$ mount /dev/hda5 /mnt/usr # ...etc
$ mount -o bind /dev /mnt/dev/
$ mount -o bind /proc /mnt/proc
$ grub-setup --force '(hd0)' # this will install grub with some warnings
...
$ reboot


5. you're done !

PS: you may want to read http://wiki.debian.org/GrubTransition on the Debian Wiki.

samedi 28 novembre 2009

How-to build and install QGIS from SVN on Debian in a bandwidth-friendly way.


Quantum GIS, aka QGIS (http://qgis.org) has been orphaned out from Debian repos for various reasons.
Of course, you can find many unofficial binary packages around the web, however they are likely to fail on some unmatched runtime dependency ...
QGIS people made it simple for us to build packages on our own bu providing a convenient "debian/" directory in the source tree.

The official installation guide (http://www.qgis.org/wiki/Installation_Guide#Building_Debian_packages) provides enough information to build the package in a semi-automatic way :

"/!\ *Note:* If dpkg-buildpackage complains about unmet build dependencyies you can install them using apt-get and re-run the command."

Boring ... Why not fetch dependencies from the debian/control.xxx file ?

                                                                       
# Fetch necessary build tools, assuming a freshly installed Debian unstable (pick either stable or Ubuntu flavours) :
$ sudo apt-get install build-essential devscripts fakeroot subversion

# Fetch sources from SVN :
$ svn co https://svn.osgeo.org/qgis/trunk/qgis qgis_unstable

# Change to qgis source tree directory :
$ cd qgis_unstable/

# Magically fetch all necessary build-deps :
$ mk-build-deps debian/control.sid # you might consider other relevant control files
... # wait for the output file
$ dpkg -i qgis-build-deps_1.0_all.deb
... # fails
$ apt-get -f install # this should be easier with apt-get install qgis-build-deps_1.0_all.deb ...
... # looooong, coffee needed.

# Build package :
$ dpkg-buildpackage
... # long tools

# Install freshly built packages :
$ sudo dpkg -i ../*qgis*.deb
$ sudo apt-get -f install


PS: this method is not QGIS exclusive and could be used with many out-of-debian softwares that provides a working debian/ directory.
Who has no bandwidth constraints as I have should consider the much better cowbuilder (apt://cowbuilder or http://wiki.debian.org/cowbuilder). Those incredible tools provides nice wrappers to build packages in clean hardlinked-cow'd chroot, thus not polluting your environment with otherwise-useless build-deps packages.

Have fun !

jeudi 24 septembre 2009

Vim tips of the day : snippets, autocomplete and menus

I love being lazy when it comes to text editing. So, I loved
OmniComplete and Snippets plugins :

- snipMate : http://www.vim.org/scripts/script.php?script_id=2540 :
TextMate snippets, the Vim way (very good, easy textmate -> snipMate
conversion)
- snippetsEmu : http://www.vim.org/scripts/script.php?script_id=1318 :
just the same, older and probably a bit less reliable. Good anyway.

Vim is the kind of software you can learn everyday something about.
Today, I just found this new http://vim-fr.org site, which referenced
some neat plugins / options :

- ":set wildmenu" : simply another completion system for the Vim command
mode. Very nice and useful.

- AutoComplPop : http://www.vim.org/scripts/script.php?script_id=1879 :
this plugin simply enables the OmniComplete menu in insert mode, while
typing. Defaults settings are a bit intruding but can be changed
easily.

:wq

vendredi 11 septembre 2009

Working tiled and comfy on MacOSX : X11, dwm, urxvt, Terminus

From Jérôme Andrieux


(Easiest thing to do is not to use MacOSX in the first place, however
for those among us who actually like to work with terminals, text mode
apps and funky tiling window managers and all those tools that actually
suck less, things were made easy).

For those who just want to tile some windows, Quicksilver and some
applescript could do.

Get Prerequisites



  • MacOSX Leopard. I think one could get this working on Tiger, but
    not sure.

  • X11 packages from Leopard (default install, X11User et X11SDK
    packages from the additionnal softwares folder on the install DVD) or
    XQuartz. I had
    some problems with Xquartz 2.4.0 so I wouldn't recommend it.

  • Macports. Macports provides
    lots of brilliant softwares, among them urxvt and terminus-font.
    Macports requires Xcode.

  • dwm sources from the mercurial repo or the tarball, see here. dwm is, well, you know
    dwm.



Test your setup :

$ pkgutil --pkgs | grep X11
com.apple.pkg.X11User
com.apple.pkg.X11SDKLeo
com.apple.pkg.X11DocumentationLeo


Launch "X11.app" from Application/Utilities. From xterm, type in "xev"
and press your Option/Alt keys to obtain their keypres. You will need
those keypres later to define the dwm modifier key.

Install


dwm configuration is done at compile time by editing the header file :

$ cd path/to/dwm
$ vi config/def.h
# edit to fit your needs, note modifier key
$ make


Then install the other apps :

$ sudo port install rxvt-unicode
$ sudo port install terminus-font


At this point, Terminus font is not available in xfontsel, we need to do some
configuration.

Configure X11 session



Things you want when starting X11 :

  • launch dwm at startup

  • have a working keyboard layout

  • have a working ssh-agent

  • being able to copy/paste from/to X11/Aqua



Edit ~/.Xmodmap (I use left Alt 66 as Mod1 and right Alt 69 as normal Alt ie
options in MacOSX).:

clear Mod1
keypre 66 = Alt_L
keypre 69 = Mode_switch
add Mod1 = Alt_L


Edit ~/.xinitrc :

# if you need to customize some PATH or ...
. ~/.bashrc
# may be useless, should handle clipboards
ssh-agent quartz-wm --only-proxy &
# load your keyboard configuration, should be read by xinit
# automagically, just in case
xmodmap ~/.Xmodmap &
# add Macports/terminus fonts to X11
xset fp+ /opt/local/share/fonts/ &
xset fp rehash &
~/path/to/dwm/dwm


You could as well edit ~/.Xdefaults to setup rxvt look and feel :

URxvt.perl-ext-common: default,matcher
URxvt.urlLauncher: open
URxvt.matcher.button: 2
URxvt*font: xft:terminus
URxvt*boldFont: xft:terminus:style:Bold
Rxvt.foreground: white
Rxvt.background: #222222
Rxvt.cursorColor: white
Rxvt.reverseVideo: false
Rxvt.scrollBar: false
Rxvt.meta8: true
Rxvt.modifier: mod1


Moar Terminus!@#



if you were to like Terminus enough to want it in Terminal.app, I
recommend you use Jeramey package from http://jeramey.livejournal.com/124733.html.

mercredi 26 août 2009

Setup Virtualbox on MacOSX to boot Linux (Debian) from a raw disk partition (now without a little help from VMWare)

Virtualbox allows you to run a lot of x86 OS virtual machines, mostly from a "virtual disk image", ie a file. On the other hand, it is now easy to setup a MacOSX / Debian dual boot, for us long time Linux lovers.
While both are convenient and working nicely, it's actually pretty difficult to get Virtualbox on MacOSX using the Linux raw disk partition as a VM. It can work though, with a little help from VMWare ...


2009-09-17 : Now without VMWare, thanks to Steve Cheng workaround in the comments (dd'ing the first GPT 40 blocks to the VMDK file).


REMEMBER : this is said to be experimental and dangerous ! Try at your own risk, but backup first !



Requirements







Steps



Create the disk image with Virtualbox


List partitions to work with (3 and 4 here)



$ sudo VBoxManage internalcommands listpartitions -rawdisk /dev/disk0
VirtualBox Command Line Management Interface Version 3.0.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0xee 1023/254/63 1023/254/63 200 1
2 0xaf 1023/254/63 1023/254/63 214912 409640
3 0x83 1023/254/63 1023/254/63 38146 440549416
4 0x82 1023/254/63 1023/254/63 3814 518674418

Same thing with fdisk



$ sudo fdisk /dev/disk0Disk: /dev/disk0 geometry: 38913/255/63 [625142448 sectors]Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID>
2: AF 1023 254 63 - 1023 254 63 [ 409640 - 440139776] HFS+
*3: 83 1023 254 63 - 1023 254 63 [ 440549416 - 78125002] Linux files*
4: 82 1023 254 63 - 1023 254 63 [ 518674418 - 7812501] Linux swap

Partition #4 is the swap. I won't use it, so I'll just keep #3.


As we need to access the actual raw disks, we need to change permissions on /dev/disk0* to gain the write bit (I think write is only needed for the linux partition, but read is mandatory for disk0 and diskOs3)



$ sudo chown root:admin /dev/disk0* #providing you belong to the admin group
$ sudo chmod 660 /dev/disk0*

Copy your MBR to a file



dd if=/dev/disk0 of=disk0.mbr bs=512 count=1

Create a VMDK image



$ [ -w /Users/USERNAME/Library/VirtualBox/ ] && VBoxManage internalcommands createrawvmdk -filename /Users/USERNAME/Library/VirtualBox/HardDisks/VMNAME.vmdk -rawdisk /dev/disk0 -partitions 3 -mbr disk0.mbr -register
VirtualBox Command Line Management Interface Version 3.0.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

RAW host disk access VMDK file /Users/USERNAME/Library/VirtualBox/HardDisks/VMNAME.vmdk created successfully.

This command produced two files



$ ls -l ~/Library/VirtualBox/HardDisks/
...
-rw------- 1 USERNAME USERNAME - 32256 26 aoû 13:17 VMNAME-pt.vmdk
-rw------- 1 USERNAME USERNAME - 738 26 aoû 14:32 VMNAME.vmdk
...

This disk image have been registered (-register option) so they are ready to be used !



$ grep VMNAME /Users/USERNAME/Library/VirtualBox/VirtualBox.xml
<HardDisk uuid="{b4076b6e-1410-4ab0-b772-3a9cc18f8ceb}" location="/Users/USERNAME/Library/VirtualBox/HardDisks/VMNAME.vmdk" format="VMDK" type="Normal"/>



Create the virtual machine with Virtualbox GUI


Launch Virtualbox and create a new Debian (whatever you like actually) VM using the new registered disk image (VMNAME.vmdk here). You may also go to advanced setup and change the harddisk controller from IDE to SATA so that Debian won't have to bother between sda / hda naming, depending on your machine. I guess all Mactel have SATA disks now, not sure.


Once your machine is created, you can try to launch it and see ... FAIL. Well, Grub is OK, kernel is loading but then "Unknown partition table", "Unable to mount rootfs", ...


Using a custom MBR is not working for now, it seems that on MacOSX host, Virtualbox only supports Bootcamp'ed Vista raw disk partition. See http://www.virtualbox.org/ticket/1461




Use VMWare to produce a working xxx-pt.vmdk file


Of course, we could all use VMWare Fusion from the beginning, but I just don't like them. Anyway, download and install VMWare Fusion trial with command line tools.


Once installed, create a VM within WMWare, following http://fearandloath.us/vmware-fusion-bootcamp-partition.html advices


Basically, run



$ cd "/Library/Application Support/VMware Fusion/"
$ ./vmware-rawdiskCreator create /dev/disk0 3 /Users/USERNAME/VMNAME.vmwarevm/VMNAME.vmdk ide

This will create the same files as before, but this time



$ ls -l /Users/USERNAME/VMNAME.vmwarevm/VMNAME-pt.vmdk
-rw-------@ 1 USERNAME USERNAME - 32256 9 jul 19:52 VMNAME-pt.vmdk

Once you get there, backup your existing Virtualbox generated -pt.vmdk file and copy the VMWare there instead (make sure vbox and fusion are off)



$ cd ~/Library/VirtualBox/HardDisks/
$ mv VMNAME-pt.vmdk VMNAME-pt.vmdk.vbox
$ cp /Users/USERNAME/VMNAME.vmwarevm/VMNAME-pt.vmdk .

You can notice the difference in size between the two of them



$ ls -l ~/Library/VirtualBox/HardDisks/
...
-rw-------@ 1 USERNAME USERNAME - 32256 26 aoû 13:17 VMNAME-pt.vmdk
-rw------- 1 USERNAME USERNAME - 512 19 aoû 17:42 VMNAME-pt.vmdk.vbox
...




Booting


Now, finally, you can boot the VM. Grub and the kernel should understand the partition table and mount the rootfs. Enjoy !




Troubleshooting


Many things can go wrong, especially because I began to look at this a while ago, so some errors could have found their way in.




  • permissions : you need to understand UNIX permissions and ownership to fix perms on disks and files. I think this could be made a little bit safer by not letting the write bit on all partitions (disk0s3 only should do).

  • permissions again : permissions on disks are only set until reboot, you may have to fix a service otherwise Virtualbox will complain that disks are not accessible (VMWare prompts you for an admin password ... Clever.)

  • Grub, MBR, GPT, rEFIt mess : I never took time to read about EFI, GPT, MBR, etc. This could be problematic for you, however, if you already have a working dualboot setup, it should be OK (try gptsync from rEFIt otherwise).



Moreover, it would be nice to understand what VMWare is writing in this -pt.vmdk file to make it understandable by the Linux Kernel or maybe just what Virtualbox is doing wrong ...


vendredi 21 août 2009

De ces téléphones qui craignent, du Samsung Galaxy surtout.


Rhaaa, c'est moche. Il fait beau, c'est l'été et pourtant, je ne fais que me plaindre.


Je ne suis pas un grand fana de gadgets tendance, ni de téléphones portables en particulier. Mon coté geek se gavant d'autres nourritures plus consistantes, il m'arrive pourtant d'apprécier le coté pratique de certains gadgets actuels.

Par flemme, j'ai longtemps été fidèle à Nokia. Ainsi, j'ai apprécié l'utilisation d'un très classique 6230i, puis d'un 3110 Classic. J'ai utilisé souvent et beaucoup les fonctions de base, le lecteur MP3 ou le Tuner FM pour les trajets en vélo ou en métro jusqu'au boulot ... Pour le boulot et pour le reste, j'ai aussi beaucoup utilisé la fonction modem en bluetooth. Incroyablement pratiques, faciles à synchroniser sous Linux ou Mac, avec une durée de batterie largement suffisante pour tout faire.

À l'occasion d'un changement de fournisseur, j'ai acheté un Nokia E71, pour son clavier AZERTY et la possibilité de lire les mails ... Un peu de hype, toujours un Nokia, pas cher avec un nouvel abonnement. Je n'ai pas vraiment été surpris, il marche bien comme les autres. Vraiment, ça marche bien, on ne se pose pas trop de questions, tout fonctionne vite, bien et looongtemps. Parfait. En plus, ce sont les mêmes connecteurs (casque, chargeur et mémoire) que le 3110 ...

Pour des raisons de couvertures, j'ai ENCORE changé d'opérateur et en consultant les offres de l'opérateur B, je vois que vient de sortir un nouveau téléphone Android, le Samsung Galxy (ou GT-i7500).
Haaaaaa, que de chants doux à mes oreilles : un système Linux convivial, une intégration sympathique avec les trucs Google (que j'utilise donc c'est bien, hein ?), le tout vaguement propre et beau ... Je vois même que Ghantoos arrive à faire des trucs bien avec.
Bon, au final, après quelques semaines d'utilisation, voilà ce que j'en retiens :
- la batterie ne tient pas. Après 2 jours, dans 90% des cas, c'est mort. Au début, c'est pire ...
- le téléphone reboot tout seul. Pénible, il reste bloqué sur la saisie du PIN.
- il reste bloqué en "veille", écran noir, obligé de retirer la batterie ...
- les mises à jour se font par l'intermédiaire d'un logiciel Samsung qui ne fonctionne que sous des OS sales, donc ne se font pas chez moi ...
- le clavier virtuel est tout moisi par rapport à celui des iPod ou autre Tomtom que j'ai eu l'occasion d'utiliser.
- la housse fournie avec est trop petite et appuie sur les boutons quand on le glisse dedans, ridicule.

M*rde, si on ne peut pas compter sur son téléphone pour rester allumé, c'est moche.

D'un autre coté, le système Android est vraiment, pour de vrai, très sympathique et il semblerait que le travail de Samsung ne vaille pas celui de HTC ...
Comme Samsung ne permet pas les mises à jour "OTA" (Over The Air), je pense que je vais tester les ROM non officielles distribuées (genre Fatality et autres Drakaz), qui apparemment régleraient les problèmes, dès le retour du SAV. Haaa, là encore, je pourrais certainement écrire des pages d'insultes, verser des litres de bile ou hurler jusqu'à assourdissement, mais c'est l'été, il fait beau.

Voir donc :
- pour le bien chez Ghantoos : http://ghantoos.org/2009/08/08/running-debian-on-a-samsung-galaxy-under-android/
- pour du bien probable des ROM non officielles : http://www.frandroid.com/forum/viewtopic.php?id=1803
- pour le milieu chez Korben : http://www.korben.info/samsung-i7500-reboot.html
- pour le pas bien qui inonde Google : http://www.google.fr/search?q=samsung%20galaxy%20problèmes&ie=utf-8&oe=utf-8