Friday, January 25, 2013

Insert a CD image file in gnome-boxes

As I heard about the new Age of Empires II extension "Forgotten Empires" created not by Microsoft, but by an awesome community, I needed to play this game again! I don't like Wine that much as I once got a bunch of viruses having it just installed, therefore I decided to install Windows XP in a virtual machine.
I chose GNOME Boxes as it uses kvm. It was really fast and easy to install, I just needed my Windows-Installer-CD as an *.iso file.

However, I could not find any option to insert another *.iso image file to be mounted in the guest system. The user interface just does not provide to change the CD disc image - so we have to change the kvm options in another way. Open your terminal and type:

$ virsh edit Windows\ XP\ Pro.iso

(If you installed something else than Windows XP you might have to look in the folder .local/share/gnome-boxes/images/ how your machine is called.)
In this file search for the lines saying something like the following and exchange your iso-filename (+path):

<disk type='file' device='cdrom'>
   <driver name='qemu' type='raw'/>
   <source file='/home/tux/AoE.iso' startupPolicy='optional'/>

(If you need help using vim, check this out.)
Save it, reboot your Windows and enjoy having your disc image in the CD drive of the guest!

Friday, January 18, 2013

Linux: Start long running jobs with SSH

Recently I needed to start several long running jobs at my working machine from home using SSH. Unfortunately closing the SSH connection stops all the tasks started in this session.

Therefore we need a tool to start some tasks which will be kept running upon logout: SCREEN
There are tons of tutorials and howtos out there and a man page exists too.
However, here the most important commands and shortcuts:
Start it with typing

$ screen

then start your job, then press Ctr + A, Ctr + D  to detach the job and close the program without killing the running task. Running

$ screen -r

will resume your previous session.

Ctr + D closes the session and kills all tasks.
Ctr + A, Ctr + C opens a new screen "window",
Ctr + A, Ctr + N moves to the next window,
Ctr + A, Ctr + P moves to the previous window,
Ctr + A, Ctr + D detaches the task and closes the window,
Ctr + A, ESC enters scroll mode: use Up/Down/PgUp/PgDn to scroll, ESC again to exit this mode

Friday, November 23, 2012

Windows as Guest in Linux with minimal Software

You have Linux (any distribution, commands below for Debian/Ubuntu) and need to do just one tiny thing with Windows? Therefore you don't want to install thousands of packages and third party packages?
Then follow this quick guide made out of 4 steps and one package you need to install!

Fist install the kvm engine typing this into a terminal:

$ apt-get install kvm

Afterwards change into the directory where you want your virtual harddrive image to be created. The next command will create a *.img file with a size of 8GB.

$ dd if=/dev/zero of=vm_disc.img bs=1024k count=8000

Once this is done, you can boot up your virtual "machine" for the first time - of course with the Windows Install CD "inserted" into your device:

$ kvm -m 2048 -cdrom Windows_XP.iso -boot d vm_disc.img

Remember that you might have to exchange the name of your install-cd image.
Reading the manual of kvm (terminal command: man kvm) I found some nice features like graphical output to a vnc stream, using a specific sound-card, forwarding usb devices,... I am always using following command to start my virtual machine:

$ kvm -m 2048 -hda vm_disc.img -vga std -soundhw ac97 -usb -usbdevice tablet -smp 2 -vnc :0

Afterwards I connect to the vnc stream (localhost) using the "Remote Desktop Viewer" application.
Source: http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/

Have Fun!

VLC as DLNA Client on Linux

Since version 2.0 VLC is able to play content from a DLNA Server.
On Ubuntu it seems not to be working out of the box. The first challenge is to realize, that a probably installed firewall (eg. ufw) is blocking all incomming traffic, meaning the broadcast of the DLNA server is not seen.

Add a rule to the firewall, to enable incoming traffic on port 1900 UDP for your media-server IP.
Therefore you might want to use a graphical user interface like gufw installable either in the Software Center, or with the terminal: 

$ sudo apt-get install gufw

Afterwards VLC should be able to see your DLNA server, but when double clicking, it seems that nothing happens. But this is not true - if you look more closely, you will realize that you suddenly have a lot of wlan/lan traffic. VLC is syncing the database without any graphical feedback. This is not really user-friendly.
After some time (depended on the size of your database, so be patient...) a folder icon appears, double clicking on it takes a looong time again. This process without graphical feedback (again!) is finished when you see a triangle in front of the folder... YAY! 

Now you can browse your database and start a movie, songs and even look at images!

Have fun!


Tuesday, November 6, 2012

Save the environment AND your eyesight!

I have to read a lot lately and therefore I print out everything. I don't like to read publications, papers and other scientific stuff on the screen, as there is no easy possibility to take down notes, mark some lines and interact with this thing. I just like to work with paper and pencil!

To save the environment a little bit, I always print two pdf pages onto one sheet - double-sided of course - leading to 4 virtual pdf pages being printed onto one single sheet of paper.
This is awesome, but my eyes start to hurt after some time, because the text is so unbelievably small. However, I realised that there is a lot of white space on these sheets and somehow it should be possible to remove the white space and "zoom" the pages a little bit for a better readability.

Exactly this is done by pdfcrop (http://pdfcrop.sourceforge.net/)!
You just type something like

$ pdfcrop --margins 5 input.pdf output.pdf

into your terminal and then print the output.pdf as usual. You will realise that the font size has almost doubled (or sometimes even more), only with removing the white borders. Happy reading!

Saturday, June 23, 2012

Switching graphic cards on the Thinkpad T400

I just realised that a lot has changed since I looked for support of Hybrid Graphics under Ubuntu/Debian a few years ago. Now, there is a project for switching between the integrated and discrete graphic card called vgaswitcheroo!

In the BIOS settings you have to select "Switchable Graphics" and the computer will boot up with the internal graphics card (in my case Intel 4500) turned on.
With one simple command, you can then switch to the discrete graphics (ATI Radeon HD 3400). The only expense at the moment is, that you have to log out and in again to restart the x-server.

To switch to the discrete graphic card open the Terminal and type:
sudo echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch
Then log out and in again. You can then check your running graphics card under "Details" in the "System Settings" (running Gnome 3.2 or higher).

To switch to the internal graphics type:
sudo echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch
Thanks for this awesome tool!
Source: https://help.ubuntu.com/community/HybridGraphics

Do you want to automate things?

I created a shell script, which detects the running graphics card and asks you whether to switch or not!
Download it, make it executable and run it as superuser! I commented every piece of code to make it readable for you.
Download: https://github.com/j-4/scripts/blob/master/switch_graphics.sh

Have fun!

Saturday, June 2, 2012

Most perfectly fitting Raspberry Pi Paper Case

Previously I downloaded the famous Punnet paper case (http://www.raspberrypi.org/archives/1310), but unfortunately it was not really fitting. The base area was too broad and the holes for audio out, HDMI and micro USB not properly placed.

Therefore I measured the whole Raspberry Pi in detail and quickly drew a case based on the Punnet, but without the annoying bugs.



You can choose which file to DOWNLOAD:

I think you are smart enough to figure out where to cutfold and glue ;-)
The case has to be folded in a way that the lines are inside!
Keep in mind that you uncheck "Fit to printable area", and that you do not use scaling for printing.

Further, if you glue paper edges above the HDMI and the micro-USB plug, the board is even more stable in the case! There is no wobbling or squeezing (See photos for details).

Here some photos of the resulting paper case:




This case, as well as the all blog-entries, images,... are published under the Creative Commons License: http://creativecommons.org/licenses/by-nc/3.0/

So, if you still find a bug, just download the *.svg and fix it (or comment here)!