četrtek, 12. december 2013

VirtualBox error: UUID does not match the value ....

When you try and start a VirtualVM VM and get this error:
UUID {SOME_UUID} of the medium 'PATH_TO_VDI' does not match the value {SOME_UUID} stored in the media registry ('PATH/VirtualBox.xml')

then you could solve it with this steps:
- open File - Virtual Media Manager
- do Release on the problematic VDI
- do Remove on the problematic VDI. Don't delete the physical file
- on specific VM attach the VDI back

sreda, 27. november 2013

Faster fetch from DB2 cursor

If you are using cursors in DB2 procedures, for example, and you don't use them to update the data, you can significantly improve fetch performance using FOR READ ONLY:

    DECLARE XSQL                    VARCHAR(10240);
    DECLARE XSQLSTATE_1             STATEMENT;
    DECLARE XRESULT_SET_1           CURSOR WITH RETURN TO CLIENT FOR XSQLSTATE_1;

    SET XSQL = 'SELECT * FROM SYSIBM.SYSDUMMY1 FOR READ ONLY WITH UR';
    PREPARE XSQLSTATE_1 FROM XSQL;
    OPEN XRESULT_SET_1;

XRESULT_SET_1 is returned back to the client, so it can iterate over the data.

No menus in Java applications under Ubuntu

If you run a Java application under Ubuntu and you don't see any menus (when you klick on a menu, you don't see menu items) run the application like this (example for running jmc):
UBUNTU_MENUPROXY= jmc

This will disable menu proxy for this application. More on disabling menu proxy here.

nedelja, 24. november 2013

Disc burning software under Ubuntu

Take my advice and only use k3b. It does install a lot of stuff from KDE, but it is worth it.
I've used brasero, cdw, bashburn, ... but k3b is the only one that works as you'd expect.

Not able to change desktop wallpaper on Ubuntu

sudo apt-get install dconf-tools
dconf-editor
go to org -> gnome -> settings-daemon -> plugins -> background and activate "active" :)

Now you will be able to change desktop backgroup

četrtek, 17. oktober 2013

Make java plugin run in Chrome under Linux

If you go to http://www.java.com/verify/ and Chrome want's you to install Java plugin follow this steps:

mkdir /opt/google/chrome/plugins
cd /opt/google/chrome/plugins
ln -s /usr/local/jre1.7.0_45/lib/i386/libnpjp2.so .

torek, 10. september 2013

Getting SQL917 on DB2 while executing DDL statements

I'm using DB2 9.7.5 Express-C on Windows and Linux. Usually I get this if I'm running a lot of DDL statements in a transaction.
The only solution until now that I found is to restart the database and reissue DDL statements.

If anyone knows more about this please comment.

Grouping icons on Unity launcher

During past months that I've been using Ubuntu and Unity the Launcher got crowded with vaious icons of program I installed and program I put on the launcher.
Things gor messa, so I needed a solution. It came to me in a form of "Drawers". More on the can be found here and here.

Tabs in Skype

I'm using Skype 4.2.0.11 and I'd like to have Skype use one window for all the things I do with it. By default it has two winodws (Contact and Chat window).
This can be changed by using SkypeTab found at http://keks-n.net/skypetab/
Now I can see my contacts on the left side of the windows and chats, each in it's own tab, on the right side.

ponedeljek, 1. julij 2013

How to drop a DB2 instance if instance owner does not exist anymore

Let's say that your instance owner was user db2inst1 and you removed it via OS tools. When you want to uninstall DB2 it complains that you have to drop db2inst1 instance. Running db2idrop gives you error, since user db2inst1 does not exist anymore. In this case you can use this:
db2greg -delinstrec instancename=db2inst1
db2greg is a nice tool that lets you display and alter global registry. More at DB2 10.1 Info Center

Enable hibernate in Ubuntu 13.04

Follow these steps:
- open terminal
- sudo vi /var/lib/polkit-1/localauthority/50-local.d/hibernate.pkla
- paste these lines:

[Re-enable Hibernate]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

- reboot

torek, 25. junij 2013

NetBeans in maximized mode on Ubuntu 13.04

Today I upgraded my laptop (Dell Latitude E5520) to Ubuntu 13.04.
On there I'm also running NetBeans 7.3.1 on JDK 1.7.0_25. The problem I had was that when I maximized NetBeans the content of the window was not refreshed.
After testing several settings I found that setting sun.java2d.opengl=false fixed the problem.

Laptop is using Intel graphics card with a i915 driver. Maybe there is some kind of a problem between this setting and Java. I don't know.

petek, 19. april 2013

Mouse not working after suspend in Ubuntu 12.04

If you mouse is now working after computer gets back from suspend try this:

  • sudo vi /etc/pm/sleep.d/20_custom-ehci_hcd:
#!/bin/sh
# File: "/etc/pm/sleep.d/20_custom-ehci_hcd".
TMPLIST=/tmp/ehci-dev-list
case "${1}" in
        hibernate|suspend)
        ;;
        resume|thaw)
     chvt 1
     chvt 7
        ;;
esac

  • sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd 

četrtek, 28. marec 2013

Initialize DB2 environment in cmd

Usually when I want to work with DB2 on Windows I run db2cmd, so the DB2 environment gets initialized. However this does not work if I'm connected to a Windows machine via SSH, since db2cmd opens new cmd window.
Solution to this problem is typing "db2cmd -i -w db2clpsetcp" in cmd. Wihout quotes of course.

sobota, 23. marec 2013

Ubuntu: Make F10 work in Midnight Commander

If you are using Unity and Midnight Commander in gnome-terminal then F10 gets send to the terminal program not the Midnight Commander.
Here are the steps to correct this:

  1. install compizconfig-settings-manager
  2. run it
  3. go to "Ubuntu Unity plugin"
  4. disable "Key to open first panel menu"
  5. go to terminal menu Edit - keyboard shortcuts and disable "Enable the menu shortcut key (F10 by default)"
  6. paste this code into terminal (https://bugs.launchpad.net/ubuntu/+source/unity/+bug/726639/comments/18):

mkdir -p ~/.config/gtk-3.0
cat< ~/.config/gtk-3.0/gtk.css
@binding-set NoKeyboardNavigation {
     unbind "F10"
}
* {
     gtk-key-bindings: NoKeyboardNavigation
}
EOF

Ubuntu: How to change the location of various default directories


If you want to change the location of the Desktop, Documents, Download, ... directories:
vi ~/.config/user-dirs.dirs

nedelja, 24. februar 2013

Finding bad blocks on hard drive in Linux

Run:

  • sudo badblocks -v /dev/sda1 > bad.block
  • sudo fsck -t ext4 -l bad.block /dev/sda1
badblocks is part of the e2fsprogs package in Ubuntu. The first command will find all bad blocks that you may have on /dev/sda1 and the second one will try to move data found in bad blocks to another place. If it can't then the file may be corrupted and lost.

petek, 22. februar 2013

Pass all script arguments to another script

When you want to pass all the input arguments to another script or program you can do it like this:

  • in bash use "$@"
  • in bat use %*

From Kubuntu to Ubuntu

Steps:

  • sudo apt-get install ubuntu_desktop
  • change display manager to lightdm as described in Change Linux display manager
  • change lightdm greeter theme as described in Change lightdm greeter theme
  • set ubuntu boot splash screen:
    • sudo update-alternatives --set default.plymouth /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth
    • sudo update-alternatives --set text.plymouth /lib/plymouth/themes/ubuntu-text/ubuntu-text.plymouth

četrtek, 21. februar 2013

Change Linux display manager

You can have mulitple diplay manager installed at any time:

  • gdm
  • lightdm
  • kdm
You can switch between them:
  • if you have gdm running then use
sudo dpkg-reconfigure gdm

  • if you have kdm running then use
sudo dpkg-reconfigure kdm 

  • if you have lightdm running then use
sudo dpkg-reconfigure lightdm

Change lightdm greeter theme

Run
sudo vim /etc/lightdm/lightdm.conf
and change

greeter-session=unity-greeter
to
greeter-session=lightdm-gtk-greeter
or something. There are multiply *-greeter packages you can install and use

Disable scrollbar overlay in Ubuntu

In 12.04:
gsettings set org.gnome.desktop.interface ubuntu-overlay-scrollbars false

In 12.10:

gsettings set com.canonical.desktop.interface scrollbar-mode normal

And to return to the default settings:
gsettings reset com.canonical.desktop.interface scrollbar-mode

All commands are run from console



Touchscreen calibration under Linux

If you have a touchscreen and want to caibrate it follow this steps:

  • sudo apt-get install xinput-calibrator
  • run it. You can run it from console or find it somewhere in your menu
  • after calibration you will get an output in your console and the line you should copy looks something like this:
    Option "Calibration" "77 3935 115 3984"
  • sudo vi /usr/share/X11/xorg.conf.d/10-evdev.conf and copy previous line in touchscreen section:
    Section "InputClass"        Identifier "evdev touchscreen catchall"
            MatchIsTouchscreen "on"        MatchDevicePath "/dev/input/event*"        Driver "evdev"        Option "Calibration" "77 3935 115 3984"EndSection
I've used xinput_calibrator on Ubuntu 10.11 and 12.04.

sreda, 13. februar 2013

torek, 1. januar 2013

2013

I wish a happy new year 2013 to all of you out there.