czwartek, 30 września 2010

Double-sided printing under Linux

I often have a lot of documents to print and prefer double-sided printouts. Most Linux printer drivers (if not all) don't support double-sided printing, you can always do it by hand .. but i'm just too lazy for such a solution. I wanted to magically rearrange my pdfs for double-sided printing. For my printer (Minolta 1300W) I have to first print even pages, then insert the paper back to paper feeder and continue printing odd pages is reversed order. To accomplish this task I used pdftoolkit (http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/). In most Linux distributions it should be available in repository, like in Ubuntu you can install it using Synaptic or typing in a terminal

sudo apt-get install pdftk

To convert my pdfs I had to use the following command
pdftk A=kalman_intro.pdf cat A1-endeven Aend-1oddS output kalman_dsp.pdf

You first select the input file kalman_intro.pdf with handle A, then use parameter cat for catenate, then select all even pages of document A (from 1 to the last page - end), select all odd pages in reversed order (handle A, from last page to first, odd pages) - the S stands for south and tells pdftk to rotate these pages 180 deg. Finally you specify the output file. This way you can make any pdf double-sided printing ready without effort :).

For some more info on pdftk try
http://www.pdflabs.com/docs/pdftk-man-page or http://www.pdflabs.com/docs/pdftk-cli-examples/

java.util.MissingResourceException: Can't find bundle for base name ....

I had some nasty problems using ResourceBundle and it's subclasses. No matter what I tried always finished with

java.util.MissingResourceException: Can't find bundle for base name

Unfortunately ResourceBundle.getBundle doesn't look for your translation files in the package in which it's used but a default package ''none''. The solution is to use fully-qualified-resource-names like com.project.file. You can find the fully-qualified-resource-name by viewing the structure of default_project_directory/build/classes/. For abc/g.package you should use
ResourceBundle.getBundle("abs.g").

http://blogs.sun.com/chengfang/entry/p_java_util_missingresourceexception_can

wtorek, 21 września 2010

Turning on compositing in metacity

Metacity is the default window manager in many Linux distributions such as Ubuntu. By default the compositing is switched to off .. so you may have problems with eye-candy docks like docky. To turn on compositing in metacity open the gconf-editor (from terminal or using alt+f2) and switch
apps -> metacity -> general -> compositing-manager to on.

poniedziałek, 20 września 2010

Broken ubuntu 2.6.32-24 kernel, fglrx can't be installed

So you wanted to install fglrx driver for your ati card on Ubuntu with 2.6.32-24 kernel but finished with an error like ...

update-alternatives: using /usr/lib/fglrx/ld.so.conf to provide /etc/ld.so.conf.d/GL.conf (gl_conf) in auto mode.
update-initramfs: deferring update (trigger activated)
Loading new fglrx-8.771 DKMS files...
First Installation: checking all kernels...
Building only for 2.6.32-24-generic
Building for architecture amd64
Building initial module for 2.6.32-24-generic

Error! Bad return status for module build on kernel: 2.6.32-24-generic (amd64)
Consult the make.log in the build directory
/var/lib/dkms/fglrx/8.771/build/ for more information.

Seems the current kenel is broken .. my 'fix' to this issue was returning to kernel 2.6.32-23. After changing the kernel fglrx installs perfectly.

If you don't have this kernel installed just grab it from the repo using synaptic or apt-get.
This package is named 'linux-image-2.6.32-23-generic'.

niedziela, 19 września 2010

Fix virtualbox usb on a ubuntu host

You can't use usb devices with virtualbox? They show up in the list but are disabled?
Just add your user do vboxusers group by running in the terminal

sudo usermod -g vboxusers $(whoami)

and after relogging usb support in virtualbox should work like a charm.

sobota, 11 września 2010

Mounting ssh shares using sshfs

SSH is absolutely great. You can not only access remote computer's shell but also files. Probably you know you can access a ssh server using places -> connect to server from Gnome's menu. It's very usefull but with some programs (like matlab) you need to your mount ssh share. To do so you'll need sshfs ...

sudo apt-get install sshfs

To mount your share just use

sshfs [user@]host[:remote_dir] mount_point [ssh_options]

so for example

sshfs bodwick@192.168.0.1:/home/bodwick/my_ssh_share ~/my_remote_ssh_share/

to mount directory 'my_ssh_share' placed in remote user's home folder, host ip 192.168.0.1 using user name 'bodwick', the share is mounted in 'my_remote_ssh_share' in local user's home folder.

In case of any problems just consult the man pages.
http://www.digipedia.pl/man/doc/view/sshfs.1/

czwartek, 9 września 2010

Run app in background

So you want to run some application in background without closing it you don't know how?
Try adding & after the command and it's arguments.

appname args &

Chroot

Chroot is great and powerfull. Comes very usefull when you want to repair a Linux install straight form Live-cd. Just follow the steps:

mount -t proc none /media/DISK/proc
mount -o bind /dev /media/DISK/dev
cp -L /etc/resolv.conf /media/DISK/etc/resolv.conf

Of course change the DISK with a propper drive name.
The last command is

cp /etc/resolv.conf /media/DISK/etc/
chroot /media/DISK/ /bin/bash

Enjoy :-)